views:

54

answers:

1

Hi everybody !

I am developing an application that use the GPS and the geolocalion. So, during the application launch, I have to be sure that the user has activated the network and GPS. If he didn't tested 2 solutions :

  • Ask the user to activate them himself (so the application quit, and the user has to reload it)

  • Redirect the user in the corresponding view in order to activate them ( via something like " android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS " )

The second solution is better to my mind but can be very boring for the user if he has to activate the Network + the GPS + Nework localisation ...

That's why I ask if it is not possible to activate all that automatically if it is not possible ? I think it is possible because it exists widget that let the user activate network, gps etc... but how can we do that in the application ???

thanks for reading ;)

+1  A: 

As Lie Rayn says in his comment to your question. You cannot activated GPS directly via code. but I think this blog post it is what you're looking for.

You can start an activity which then shows the user the "Locations and Security" setting page where GPS can then be activated.

Flo
Ok, that's what I did in the "second solution". I just wanted to be sure that it is not possible to achieve that in an easier manner.Thank you ;)
alexandrebour