简体   繁体   中英

Prompting User to Enable GPS

Correct me if I am wrong:

1) You cannot programatically turn GPS On/Off on all versions of Android. Maybe some previous versions, and some hacks, but not on all devices. It simply is not allowed.

This leaves only two options:

1) Use new Google Play Services to prompt user to change these settings. One issue with this is what if you just want to allow user to turn on GPS, but not WIFI? The resolver will give them options to turn on both. How can you just turn on one but not the other?

2) Send user to the settings application by firing off an Intent.

Now with 1) User must have current google play services installed. If not they can be prompted to install it via standard GPS dialog.

Ok, now for 2) Sending user to settings application. I have the following problem:

When I fire off this intent, they not only get to change the Location/GPS Settings but they can also hit the little back button within Settings app, and adjust all settings. Is there any way to prevent this? Anyway to bring up the Location/GPS Settings without the inner back button? Thanks.

You cannot programatically turn GPS On/Off on all versions of Android. Maybe some previous versions, and some hacks, but not on all devices. It simply is not allowed.

Correct, for obvious privacy reasons.

When I fire off this intent, they not only get to change the GPS Settings but they can also hit the little back button within Settings app, and adjust all settings. Is there any way to prevent this?

No.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM