Background location tracking

2110
4
08-22-2014 12:09 AM
ShiminCai
Occasional Contributor III

Hi,

I'm looking for ideas of how to track user's movement in background thread... While user is collecting point, line or polygon features and moving around in field, I also want to record his route and ultimately save it as a line feature to the local geodatabase. Note that the map's touch delegate has been already used by the sketch layer in the main thread. Is this possible?

Thanks,

Shimin

0 Kudos
4 Replies
GagandeepSingh
Occasional Contributor II

Hi Shimin Cai‌,

You can use Key-Value Observing approach for this. You can add an observer for "self.mapView.locationDisplay.mapLocation" and every time it changes you just insert a new point

into the AGSSketchGraphics which is already instantiated with an AGSMutablePolyline.

Let me know if this helps.

ShiminCai
Occasional Contributor III

Hi Gagandeep,

Thanks for the idea. I'll give it a go...

Cheers,

Shimin

0 Kudos
DiveshGoyal
Esri Regular Contributor

Have you checked out the GPSSketchingSample‌ ?

0 Kudos
ShiminCai
Occasional Contributor III

Hi Divesh,

Thanks for the suggestion.

Yes I did. It uses a sketchGraphicsLayer as the mapView.touchDelegate and inserts a point into the sketchGraphicsLayer in the locationManager's delegate whenever there is a location update. If I don't set up the map's touch delegate it doesn't work. In my case, the map's touch delegate has been already used by the sketching (point, line & poly) on the main thread. I need to record user's movement in a background thread without any user interaction...

Thanks,

Shimin

0 Kudos