Reputation: 1007
How can i get the GPS cords every 15min like a back processes without user interface i already have the cords Latitude and Longitude when the user do some task on the app but i am trying to record the GPS position each 15min to make a map route so the user can see all the places that he go during that day and the route that he take.
I know how to get the cords, i don't know how to do that automatically when the app is not active there's any way to do this? or is there any other approach?
Upvotes: 1
Views: 193
Reputation: 3034
Every 15 minutes when the App isn't running is probably not going to fly. You may need to change your spec a bit. Periodic Agents are restricted to running every 30 minutes plus or minus about 10 minutes. Furthermore, you won't be able to get the location right now as the Microsoft.Devices.Sensors API is restricted. You can, however, still use the GeoCoordinateWatcher which accesses a cached version of the phone's location.
This is done because using the GPS all the time will drain the battery pretty quickly. Rather than having a bunch of apps hammer away on the GPS hardware all the time, the operating system will try to get the location every 15 minutes and then hand out the info to the apps that need it.
Upvotes: 1