Re: [android-developers] GPS does not stop after ending my app

2011-03-21 Thread TreKing
On Mon, Mar 21, 2011 at 8:19 AM, Stephan Wiesner  wrote:

> Any ideas?


You're passing in "new GeoUpateHandler", for which you do not maintain a
reference to later remove. Passing in "this" (whatever "this" is) has no
effect, for "this" is not referencing the "new GeoUpdateHandler".

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] GPS does not stop after ending my app

2011-03-21 Thread Stephan Wiesner
Hi,
I have an app that uses MapView to display data. It uses locationManager to
determine the position of the user and if use of GPS is allowed by the user,
GPS is used.
The problem is that the app does not stop using the GPS (and draining
battery).
I start it using:

locationManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
1000 * 60, 20,
new GeoUpdateHandler());


I tried this in onPause() and/or onDestroy(), but it does not help, though
the methods are

@Override
protected void onPause() {
super.onPause();
locationManager.removeUpdates(this);
log("pause");
}

@Override
protected void onStart() {
super.onStart();
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
1000 * 60, 20,
this);
log("onstart");
}


Any ideas?

Thanks,
Stephan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en