I used this code to turn on GPS:

String allowedProviders = LocationManager.GPS_PROVIDER;
Settings.Secure.putString(getContentResolver(),Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
allowedProviders);

In AndroidManifest I set permission:

<uses-permission
android:name="android.permission.WRITE_SECURE_SETTINGS"></uses-
permission>
<uses-permission android:name="android.permission.WRITE_SETTINGS"></
uses-permission>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"></uses-
permission>

But it doesn't work. I have a rooted phone.

I tried yet this solution:

Settings.Secure.setLocationProviderEnabled(getContentResolver(),LocationManager.GPS_PROVIDER,
1);

But Android doesn't see  this function: setLocationProviderEnabled();

May I I do something wrong. If you know how it will work, help me, or
if is another solution, please write me.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to