I developed a windows phone application that send GPS data to my server every 30 minutes, and set it as a background application (to send GPS data even my application is closed). but there is a problem here , my app works and send me GPS data , but the data is incorrect. look at this example :
time | Coordinate | Application State | Description 8:0 | 30.0 : 40:0 | IS Running | Correct 8:31 | 31.0 : 40:0 | IS Running | Correct Now I close the application in 8:35 9:10 | 31.0 : 40:0 | Closed | Invalid 9:31 | 31.0 : 40:0 | Closed | Invalid 10:0 | 31.0 : 40:0 | Closed | Invalid Now I start my application 10:10 10:31 | 115.0 : 67:0 | IS Running | Correct 11:1 | 114.0 : 69:0 | IS Running | Correct Now I close the application in 11:15 11:31 | 114.0 : 69:0 | Closed | Invalid 12:01 | 114.0 : 69:0 | Closed | Invalid
as you look , when application is closed it send the last coordinate since my application was running when it is closed.
Because i am new in English i use this way to explain my problem so apologies about it any idea can be helpful.
(Coordinates all are sample)
Thanks
Ali Foroughi
It's hard to tell exactly what is wrong with the sample data you've provided but given that you're talking about closing your application I'm going to presume you're using a
ScheduledTaskAgent(Either aPeriodicTaskor aResourceIntensiveTask). If you look at Noteworthy APIs for Use with Scheduled Tasks you'll see that theGeoCoordinateWatcherclass when used from aScheduledTaskAgentdoes not necessarily use live GPS hardware data. Instead the data comes from an OS cache that is updated every 15 minutes. What this means if the GPS hardware hasn't been accessed by a foreground application in the last 15 minutes then the OS will update the cache with coarse-grained location data (eg. From WiFi access points / cell tower data). As such if yourScheduledTaskAgentends up using this data you may find that you get inaccurate GPS data - this would include very little movement being reported by the end user. If you send through theHorizontalAccurancyorVerticalAccuracyof theGeoCoordinatereturned by theGeoCoordinateWatcheryou'll probably see that while the application is running these are very low numbers (Depending on yourMovementThreshold) and when it's running under yourScheduledTaskAgentthese numbers will be much higher.