views:

94

answers:

1

Hey Guys,

I receive updates from my GPS in this way:

lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 0, locationListener);

In my onLocationChanged(Location loc)-method I want now to abort updating GPS data by specific criteria...

So how can I undo/disable the requestLocationUpdates(...) ?

Nice greetings, poeschlorn

+1  A: 

How about using this method:

http://developer.android.com/reference/android/location/LocationManager.html#removeUpdates%28android.location.LocationListener%29

Roflcoptr
oh my god, how can I be so blind? ;-) thanks a lot
poeschlorn
can I use it like this in the onLocoationChanged()-method?lm.removeUpdates(this);
poeschlorn
yes as an argument you have to pass the listener object. In your case this should be locationListener as far as i can judge from your code in the question
Roflcoptr