I am developing a app.. When i start the app my G开发者_运维技巧PS is enabled but on exit it should disable the GPS. how to do it? please help
You can disable GPS by the given code.It is working well.
Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", false);
sendBroadcast(intent);
I don't think its not possible.
Try something like this:
LocationManager.removeUpdates(LocationListener);
I hope it is what you're looking for.
You need not disable anything , just remove gpsupdate using Location Manager.. Here the code for that
(LocationManager)getSystemService(Context.LOCATION_SERVICE).removeUpdates(mLocListener);
精彩评论