Developing an android application which updates location of the user in the background. Now, for this Google provide two ways:
Getting user last location through getlastlocation() function. An alarm manager can be set and with the help of broadcast receiver and a service, location can be updated continuously. For example:
Request periodic updates from the fused location provider as shown here
Which way is the best way to get location updates in the background continuously without Android killing the background service unless user does so?