Monday, August 29, 2011

[android-developers] Re: How to toggle on gps in android programatically?

While you may not be able to programatically turn it on for the user
you still can assist the use by sending them to location settings to
turn it on themselves. That's at least better than just telling them
to hunt for it. The following should work:

startActivityForResult(new
Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS),
youRequestCode);

On Aug 25, 3:23 am, Shruthi Varma <shruthi.tlis...@gmail.com> wrote:
> Hi All,
>
> In my application, I need to toggle on the GPS programatically.
>
> This question was asked many times, and the answer is in Android, you
> can programmatically turn the Wifi on or off, but not the GPS.
>
> But many market applications can turn the GPS on or off programatically.
>
> So I thought there may be a way to do this. Please help.
>
> Regards,
> Shruthi.

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

No comments:

Post a Comment