Disable GPS via code on Android 4.2 up?

Asked

Viewed 177 times

1

How can I disable GPS via code, without user intervention?

  • Cannot turn GPS on/off without user knowledge.

1 answer

0

Try this strategy, it worked with me some time ago in the project I was, I do not remember the version I used of Android - only had this excerpt saved for backup.

Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", false);
sendBroadcast(intent);
  • Thanks for the answers, but this permission code denied from Android.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.