jeudi 15 octobre 2015

Building, a chat data logger from Android

Scenario : I have an android app that has chat implementation with pubNub.

To achieve : The message data should be simultaneously logged in our server as well, currently all data is being sent to pubnub. The data needs to be consistent without drops, so need an implementation which has no message drops in idle scenario.

What I came up with is to add data to local sqlite db table with 'isSent' column set to false. Then, use an intentService to send the message and upon server ack, update local database 'isSent' column to true.

Question : is this the best solution?

If yes, how can one maintain a Queue in intentService for the incoming messages. If user does not type for sometime, intentService's lifecycle will stop the service. Can I restart the same or start a new intentService in such scenario?

If no, please share your thoughts on a fail proof solution.

Aucun commentaire:

Enregistrer un commentaire