1

I emphasize that I mean the turn on "location/GPS" on my phone in this same time when i allow to use my location to my app.

In my application i have function that ask the user "if you allow access to information about the location of this device ?"

In fact, everything works as it should, when I reject a permission - application is turned off, and if I allow permission - this application starts up and use my location (but only if LOCATION is enabled on phone - it is my problem).

Now I have a problem because I wanted to make it as in a application maps from Google, that when I allow to use my location, function in my phone "LOCATION" it turns ON, because currently even as a allow my application to access location this also additional manually need to turn on "Location" in my phone.

What should I do in my application? It exist is a method which enables the GPS on your phone?

I dream of such a method to my application like : ***

 if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    // permission granted
                    permissionIsGranted = true;
                    *** turn on GPS on PHONE!!!!!!!!!!!!!!();

                } else {
                    //permission denied
                    permissionIsGranted = false;
                    finishAffinity();
patrick1980
  • 91
  • 1
  • 8
  • see this http://stackoverflow.com/questions/4721449/how-can-i-enable-or-disable-the-gps-programmatically-on-android – Inso Oct 17 '16 at 02:48
  • You can not programmatically enable the location settings. If you follow the duplicate, you will get the same dialog as google maps – Tim Jan 13 '17 at 10:29

0 Answers0