Change AGSLocationDisplay data source dynamically

3443
2
04-15-2013 01:15 PM
PatrickHartling
New Contributor III
In our app, we have a custom implementation of the AGSLocationDisplayDataSource protocol that receives updates from an external GPS service via a WebSocket. If the WebSocket connection cannot be established or if it is lost, we want to fall back on Core Location. This means that we need to be able to change the AGSLocationDisplayDataSource in use by the AGSLocationDisplay at any time.

So far, the approach I am using when the WebSocket connection status changes is as follows:


  1. If the current data source is running, stop it by sending -stopDataSource to the AGSLocationDisiplay object

  2. Update the dataSource property on the AGSLocationDisplay according to the new connection state

  3. If the map view is loaded, start the newly assigned data source by sending -startDataSource to the AGSLocationDisiplay object

The AGSCLLocationManagerLocationDisplayDataSource object and our custom AGSLocationDisplayDataSource implementation are allocated once during view controller setup in case that detail matters. The auto-pan mode is AGSLocationDisplayAutoPanModeNavigation unless the user has panned the map view and has not resumed navigation mode. In that case, it is AGSLocationDisplayAutoPanModeDefault.

The display of the current location after swapping the data source only sort of works. Basically, the blue dot from LocationDisplay.png stops being rendered after the first or second handling of the connection status change. The halo/pulse does get rendered at the right location on the map, although that seems somewhat unreliable as well. I am not sure if that is related to Core Location precision or something else.

Is switching the data source in this way supported? If AGSLocationDisplay is not meant to be used this way, I can go back to the drawing board regarding our handling of the connection status. Is there some other way to achieve the behavior that I want?
0 Kudos
2 Replies
PatrickHartling
New Contributor III
I have attached the source for an iPad app that demonstrates this issue. To see the problem, run the app and do the following:


  1. Tap Start and wait for the automated navigation to begin.

  2. Tap the Core Location item in the segmented control (top center); allow the app to access location information; and wait for the view to move to show the location of the device.

  3. Tap the Polyline item in the segmented control. When navigation resumes for the polyline, there will no longer be an image showing the location.

  4. Tap the Core Location item again and wait for the view to move back to the location of the device. There will be no image showing the location, but the pulsing animation will be present.


Testing of this app has been done with Xcode 4.6.2 and versions 10.1.1 and 10.1.1-u1 of the ArcGIS Runtime SDK.
0 Kudos
MuruganandhamKuppan1
New Contributor III

Did you updated for arcgis runtime SDK for iOS?

0 Kudos