Hm, so I just peeked at the source code of the Google Maps app on
Android, because they seem to get it right: if you have GPS enabled,
then it will stay on if the main Maps activity is hidden by another
activity of the same app, e.g. the Maps history screen, but it will
turn off when pausing the app via the Home button.
NMapActivity.onPause() looks like this:
protected void onPause()
{
super.onPause();
if(sActivityReference.get() == this)
{
... // stop location services
} else
{
android.util.Log.d("MapActivity", (new StringBuilder
()).append("onPause leaving the lights on for ").append
(sActivityReference.get()).toString());
}
}
but what is sActivityReference? I suppose it's some static field with
package level visibility, but it's not declared in that activity...
seems to be some Android internal magic, so I cannot use it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---