how to turn of gps when application stops in android application

I need to turn of the gps when the application stops, The gps is used globally and it is used in every Activity, how can I get an event when the app is closed?

Answers


use use the remove the update on onPause it makes save the drain of battery

  @Override 
   protected void onPause() 
     { 
      super.onPause();
      if(locationmanager != null) { 
        locationmanager .removeUpdates(locationlistner); 
      } 
      locationlistner = null;  
    }

Need Your Help

wxWidgets and context menus

c++ event-handling wxwidgets contextmenu

I'm trying to add context menus into a (large) custom control in my application but have run into a number of issues with when to create them.

Riak-CS Update ACL sometimes not working using Boto

amazon-s3 boto riak riak-cs

I have a virtualised cluster of 5 Riak-CS nodes. Stanchion is installed on the first node. These nodes are behind an Nginx reverse proxy.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.