Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off GPS programmatically when i exit my program

Tags:

android

gps

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

How i will turn Off GPS when i exit from my program...

like image 331
Eby Avatar asked Jul 22 '10 08:07

Eby


1 Answers

Try this:

locationManager.removeUpdates(myLocationListener);
locationManager = null;

This will shut down GPS for this app, but it is still available for use by other apps.

Be sure to test your app on a real phone because the emulator does not show the same GPS behavior as a real phone.

like image 63
fmo Avatar answered Oct 20 '22 10:10

fmo