Skip to content Skip to sidebar Skip to footer

Android How To Turn Location Services On Programmatically?

I am building an android app to track my device, is it possible to turn location services on via code? I have searched for code to do so I have found some and on execution of code

Solution 1:

is it possible to turn location services on via code?

Via Play Services' SettingsApi, yes. Otherwise, no, except perhaps on rooted devices or in a custom malware-friendly ROM.

Actually that opens up a dialog box, i don't want to involve user in it

Then that is not possible.

I have searched for code to do so i have found some and on execution of code it gives some sort of security exceptions

There have been various security flaws in Android that, when exploited, would allow apps to enable GPS silently. AFAIK, all of them are fixed at this point.

if impossible why so?

Privacy.

Post a Comment for "Android How To Turn Location Services On Programmatically?"