Tuesday, 15 March 2011

android - What type of background service? -


I want to get the location of the device and want to broadcast it on a database based on every x min / hour The user chooses, initially the service will not be required unless the user has logged in and it is selected to run in the background.

Would I like to use an alarm manager for this or I use a simple service that uses GPS and toggle it for long?

You need to do 3 different jobs.

A) Announce your service which is basically a Java file that receives the location and sends it to the server.

  startService (new intent (This, UpdaterServiceManager)  

B) After your user logs in and now you need a GPS service to call this code. .class));

C) Ensure that you have AndroidManifest.xml

  & lt; Service Android: Enabled = "True" Android: name = "" You have announced the service. Service.UpdaterServiceManager "/>   

D) stop the service where ever you want

  stopService (new intent (This, UpdaterServiceManager.class) );    

No comments:

Post a Comment