how to update the database from a server when the app is not running in Android -


I need to make a server call to bring new data from the server and then update the app database, and this Should the app not be running when I try to set an alarm manager in the main activity (), which is UpdateService.java :

  Incent Dadas = MyActivity. This, UpdateService.class); Pending print paintant = pendingente.get activity (My activity: this, 0, adas, 0); Get AlarmManager AlarmMGR 0 = (AlarmManager) System System (Activity .ALARM_SERVICE); AlarmMgr.Set Reparating (Alarm Manager. RTC_wequep, 3000, 1000, PI Continent);  

and UpdateService.java code:

  increases the public category UpdateService service {@ Override Public IBIR On On (Intent Intent) {log d. ("Test", "service has started"); Return tap; } @ Override Public Intreat Start Commands (Intent Intent, Int Flag, Introductory Video) {Log D. ("Testing", "service has started"); Return START_STICKY; }  

Also in my manifest:

  & lt; Service android: name = "com.secretescapes.update.UpdateService" Android: enabled = "true" Android: process = ": my_process" />  

The problem is that I can not see the log log D ("test", "service started"); What is the problem with my log cat and why is this service not started? Thank you

If you can use IntentService, this class will have the code, which will check first Whether the database is updated or not. If it has not been updated, you can write a piece of code that will get data from the server and update the local database.


Comments