a_dzik
a_dzik

Reputation: 977

Is it possible to turn on Location Services forcefully?

I'm creating an app, that heavily relies on LocationServices. For now I'm asking user to turn them on, and everything works fine.

However, when user clicks "No", the whole point of this app goes to hell. I can spam user to turn location services on from my Service, however I find this solution extremely non-elegant.

Is there a way to turn this setting on programatically? I don't care for additional permissions or so. I did my research and I only got what I already did - ask user to turn on location services with a dialog etc.

Upvotes: 0

Views: 151

Answers (2)

Rakan Matouq
Rakan Matouq

Reputation: 56

You simply cant , if that was possible then you can easily gather locations which is for some unethical reasons could be sold ... so for security reasons its not possible at all .

you can always force the user to click yes by making a really useful and helpful application that the user simply want to try and cant click no because it wont function at all ...

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006914

Is there a way to turn this setting on programatically?

Fortunately, no, for obvious privacy and security reasons, except perhaps on rooted devices.

However, when user clicks "No", the whole point of this app goes to hell.

Then advise the user once (per run of your UI) that your app cannot function, and the user should uninstall your app.

Bear in mind that many more permissions will have this same sort of user-recovable behavior with Android M.

Upvotes: 2

Related Questions