Get server updates in the background with Pull notification - Android

I want to implement a function in an android app that fetch information from the server periodically, even if the app is in the background / not running.

It should call a web service and check for updates at least 3-4 times a day, and if available, pull and show them in the notification bar. When the user taps on the notification, he should open the app screen.

Is this possible using cravings notification technology? Are there any restrictions? Can you share some tutorials to help me implement this.

Thank..

+3


source to share


1 answer


Sudo hopes this will help you move forward.

  • Create one service. This service will call the server and get updated if available and generate a notification.
  • Set re-alarm with AlarmManger. When the app launches first every 8 hours, which is 4 times a day.
  • Create a BroadCastReceiver that is called by the alarm manager every 8 hours.
  • And from the BroadcastReceive onReceive () method start the service to sync the data.

I pretend you know AlarmMAnager, Service and BroadcastReceiver.



Working tutorial Here

thank

+4


source







All Articles