Turn on GPS programmatically when i exit my program

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

Turn on GPS programmatically when i exit my program

Postby awesomeeby » Thu Jul 22, 2010 9:46 am

I have started my GPS programmatically by
Code: Select all
Intent myIntent = new intent(Settings.ACTION_SECURITY_SETTINGS); mContext.startActivity(myIntent);


How i will turn Off GPS when i exit from my program...
awesomeeby
Junior Developer
Junior Developer
 
Posts: 24
Joined: Thu Apr 15, 2010 5:04 am
Location: Kochi,INDIA

Top

Re: Turn on GPS programmatically when i exit my program

Postby blundell » Mon Jul 26, 2010 12:04 pm

use the Activity lifecycle.

In onPause(); turn it off.

lifecycle_of_an_activity-t81.html
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Turn on GPS programmatically when i exit my program

Postby awesomeeby » Mon Jul 26, 2010 12:57 pm

blundell wrote:use the Activity lifecycle.

In onPause(); turn it off.

lifecycle_of_an_activity-t81.html


Hi Plusminus
Thank you very much for your support
But i dint get proper solution for problem my question was how to turn GPS off through program !!
awesomeeby
Junior Developer
Junior Developer
 
Posts: 24
Joined: Thu Apr 15, 2010 5:04 am
Location: Kochi,INDIA

Re: Turn on GPS programmatically when i exit my program

Postby blundell » Mon Jul 26, 2010 1:04 pm

http://groups.google.com/group/android- ... ad89?pli=1

niko20 Nov 7 2009, 9:18 pm
The GPS settings can no longer be controlled directly by apps. They
changed this a while ago now.


Don't know if this has changed in the last year..

or try this

http://stackoverflow.com/questions/3306 ... my-program

Code: Select all
locationManager.removeUpdates(myLocationListener); locationManager = null;


this shutdown gps for this app, but ist still available for use by other apps.

ps.: test your app on a real phone because the emulator does not show the same gps-behavior like a real phone
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top

Return to Map Problems

Who is online

Users browsing this forum: Google [Bot] and 2 guests