0

I have an application that it makes requests to a webservice REST created using PHP. It's working perfectly my application makes requests and receive the data. But a want to know how can I make in my application to sincronize in real time with my server. It would be like an application messenger that receives the data automatically without an ask from user. How can I do it? Thanks

2 Answers2

0

To keep your app synced with your server, run a looping Timer on an interval in the background. Use it to check the server for new messages, and then feed those messages to the user.

Here a is an answer that may help you achieve this Android timer? How-to?.

Community
  • 1
  • 1
hyrumcoop
  • 362
  • 2
  • 14
0

Your "real time" and "synchronization" are misleading terms. What you need is the implementation of Push mechanism. You can use cloud messaging from google, see this for details. Or checkout sockets and implement it from the low level yourself

eldjon
  • 2,800
  • 2
  • 20
  • 23