Map API

Nutiteq Maps Lib SDK enables developing advanced mobile mapping applications.
Platforms: Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

» View demos
» Downloads

Uudised

Viimane: Tue, 17 May 2011 13:21:59
Teema: Nutimap Eesti kaardi asemele
Veel uudiseid »

Starting and stopping GPS tracking

2 replies [Last post]
wmartinez
User offline. Last seen 1 year 40 weeks ago. Offline
Joined: 01/27/2010

I have a problem where I need a map to follow the GPS, so I do the regular:


dataSource.setLocationMarker(marker);
map.setLocationSource(dataSource);

But, I also need panning and zooming. Zoom is not a problem, but when panning, each three seconds the map update and goes back with the marker in the center.

I need to stop the tracking while the user is panning, and re enabled it with a menu option. Problem is, the only way I found out was to remove the datasource. That stops the tracking, but I cannot re enable tracking, since adding back the datasource has no effect.

Is there a way to stop the GPS tracking and re enable it?
Thanks.

William Martinez

jaak
User offline. Last seen 13 hours 10 min ago. Offline
Joined: 06/19/2008

LocationMarker has method setTrackingEnabled(boolean) for this.

So make sure that marker is a field (not local variable) and then you can do:

public void mapMoved() {
marker.setTrackingEnabled(false);
}

And in your menu handler you set it to "true" again

/JaakL