How do you stop GPS from running.

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

How do you stop GPS from running.

Postby dsukhram » Mon Nov 02, 2009 6:48 pm

In my application I have the following code to stop the gps when I exit:

protected void onDestroy()
{
locManager.removeUpdates(locListener);
super.onDestroy();
}

However the gps icon is still displayed on my G2 after I close my app and ends up sucking all my battery life rather quickly. How do I stop the GPS service?
dsukhram
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Oct 06, 2009 10:49 pm

Top

Postby dsukhram » Tue Nov 03, 2009 10:01 pm

anybody?
dsukhram
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Oct 06, 2009 10:49 pm

re:

Postby dsukhram » Tue Nov 24, 2009 12:55 am

problem solved. This was kind of strange since when I closed my program I was still getting location updates. I made sure my program was closed via a task manager app. Anyways I just decided to kill the whole task by:

android.os.Process.killProcess(android.os.Process.myPid());

or

System.exit(1);
dsukhram
Junior Developer
Junior Developer
 
Posts: 16
Joined: Tue Oct 06, 2009 10:49 pm

Postby vkroz » Thu Nov 26, 2009 2:34 am

Another option -- try to call parent method first:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. protected void onDestroy()
  2.  
  3. {
  4.  
  5. super.onDestroy();
  6.  
  7. locManager.removeUpdates(locListener);
  8.  
  9. }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
vkroz
Freshman
Freshman
 
Posts: 3
Joined: Tue Nov 24, 2009 7:36 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: Exabot [Bot] and 4 guests