-4

I developed apps with android language and I have some problem to enabled location setting automatically when it's disabled. Anyone knows how to enabled location service automatically by code in my programming ?

1 Answers1

3

Android Guidelines have changed above version 4.0. You cannot change GPS off on programmatically for versions above 4.0.

You can see this link but it exploits security flaw and doesnt work on new versions of android.

Use this tutorials as it shows you the proper way of turning on/ off gps that is by asking user to do it manually.

Community
  • 1
  • 1
Sam
  • 1,237
  • 1
  • 16
  • 29
  • I need to turn on location services automatically in my apps. This method to avoid user for turn off location settings because my apps is about "GPS Tracker" for sales marketing person. Do you have any solution ? – Nicholas Pratama May 08 '15 at 09:37
  • you cannot. use this code context.startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)); to give user option to turn on the gps. – Sam May 08 '15 at 09:40