[Using MQTT in Android mobile applications]
- Persistent TCP/IP connection with ping request every 20mins (wake up by AlaramManager)
- Message lost will be happen during connection closed situation.
GCM 안 쓰고 하려면 이 방법 밖에 없나.. ?
[How to Implement Push Notifications for Android]
- Made sample application with same MQTT approach with above
[XMPP messaging pushing related article]
- 뭐 5분씩 heartbeat을 날려도 배터리 소모에는 별 지장은 없을 거라는 얘기..
XMPP is a good solution. I have used it for a push enabled, realtime, Android application. XMPP is powerful, highly extensible and easy to integrate and use.
There are loads of free XMPP servers (though out of courtesy you shouldn't abuse them) and there are open source servers you can run on one of your own boxes. OpenFire is an excellent choice.
The library you want isn't Smack as noted above, it's aSmack. But note, this is a build environment - you will have to build the library.
This is a calculation I did on battery life impact of an XMPP solution:
|
- smack을 사용할 경우 connection을 계속 유지해준다. 내부적으로 heartbeat 관련 사항은 소스를 봐야 할것 같은데.
By default Smack will try to reconnect the connection in case it was abruptly disconnected. Use ConnectionConfiguration#setReconnectionAllowed(boolean) to turn on/off this feature. The reconnection manager will try to immediately reconnect to the server and increase the delay between attempts as successive reconnections keep failing.
In case you want to force a reconnection while the reconnetion manager is waiting for the next reconnection, you can just use Connection#connect() and a new attempt will be made. If the manual attempt also failed then the reconnection manager will still continue the reconnection job.
|
org.jivesoftware.smack
|
Method Summary | |
---|---|
void | connectionClosed() Notification that the connection was closed normally or that the reconnection process has been aborted. |
void | connectionClosedOnError(Exception e) Notification that the connection was closed due to an exception. |
void | reconnectingIn(int seconds) The connection will retry to reconnect in the specified number of seconds. |
void | reconnectionFailed(Exception e) An attempt to connect to the server has failed. |
void | reconnectionSuccessful() The connection has reconnected successfully to the server. |
[Android Push Server & MQTT]
- 작성자 : 이광운 ultrakain엣gmail.com
scalibility를 고려한 push server 관련 자료.
근데 결론이 뭐지? PT 자료만으로는 모르겠다.
Asynchronous socket I/O를 지원하는 framework에서는 당연히 reactor, proactor를 사용하는 것은 당연할테고..
댓글 없음:
댓글 쓰기