Is there any way to disable google location service programmatically? I want to write an app to turn it off with a widget.
Thanks for your help!
Is there any way to disable google location service programmatically? I want to write an app to turn it off with a widget.
Thanks for your help!
As far as i know, the LocationManager is a system service that can not be turned off. Though, you can disable all the location providers that the service uses, such as Wireless location, GPS, etc.
If you're using the
UiAutomater
, you can turn off Location Services by simulating a click on the Location option in the Quick Settings. The filter logic may be platform dependent. You may analyse the view hierarchy using theuiautomatorviewer
.i.e.
build.gradle
No, sorry, you cannot disable GPS, etc. programmatically, except via an app installed on the system partition or signed by the firmware's signing key. IOW, you need a rooted phone.
Short answer is, No. But if you really need to turn it off, you can prompt the user to do it:
This might not help your situation but is the only way I know of changing the settings.