1

Just like a chat messaging application, in offline mode we can type and send any chats and these chats will be sent automatically when in online mode.

My first question is, how is the best way to store pending data (chat, for above example) before it gets sent when the device is online?

The second question is, how can to start send pending data when the device is online? any triggers? or something like scheduler which work in background? Thanks in advance.

indraep
  • 143
  • 1
  • 1
  • 9
  • 2
    First create a table to store the messages. Then implement a broadcast reciever to check the network connection and send the data stored in database and after sending clear the table data. you can use service and asynctask for sending data in background. – userDroid Sep 01 '15 at 04:21
  • @user5114910 thanks for your answer. When will broadcast receiver be called? when there is a change in connection (offline to online or vice versa), or in other condition? – indraep Sep 01 '15 at 04:27
  • you can specify intent-action while regestering broadcast reciever, so please refere this link http://stackoverflow.com/questions/15698790/broadcast-receiver-for-checking-internet-connection-in-android-app – userDroid Sep 01 '15 at 04:34
  • @user5114910 thank you ! – indraep Sep 01 '15 at 07:23

0 Answers0