The ability to turn on GPS by programs was removed from
Android after 1.5.  This is to ensure that (1) the power-hungry
GPS antenna does not drain the battery without the user
knowing it, (2) the user remains more consciously aware of
the risks of having GPS fine coordinates available to apps.

This change broke all sorts of widgets that let you toggle
the antenna on and off, though some more recent versions
have included a control panel for major phone toggles in
the notification bar pull-down.

On Jan 14, 7:17 am, ramzes0071 <[email protected]> wrote:
> I used this code to turn on GPS:
>
> String allowedProviders = LocationManager.GPS_PROVIDER;
> Settings.Secure.putString(getContentResolver(),Settings.Secure.LOCATION_PRO 
> VIDERS_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(),LocationMan 
> ager.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