Encienda el GPS dentro del código [duplicado]

Posible duplicado:
Habilite el GPS mediante programación como Tasker

I would like to know how to turn on the GPS inside the code ? someone says you cannot and other says you can, I get confused Pleas help me,

preguntado el 27 de agosto de 11 a las 18:08

I presume that what you mean is "enable GPS". Turning it on is simply a matter of using some LocationManager method to ask for GPS fixes (e.g., requestLocationUpdates()), which only works if GPS is enabled. All known security flaws that other people were suggesting to enable GPS are now fixed. -

1 Respuestas

Turning the GPS on requires user interaction as a security measure. If any application were able to turn the GPS on without the user knowing, that would be a very big privacy concern.

You can launch an Intent that takes the user to the GPS screen to turn it on / off.

startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));

Respondido 27 ago 11, 22:08

Wrong activity action, I think -- ACTION_LOCATION_SOURCE_SETTINGS - CommonsWare

I asked myself the same thing a couple of months ago, but then realized it would be a HUGE privacy concern for me to enable GPS without user interaction. - Jack

I'd been sending my app to that system config screen with 'new intent(Settings.ACTION_SECURITY_SETTINGS)', as per the original answer. ACTION_LOCATION_SOURCE_SETTINGS seems to send it to the same screen (at least on the emulator it does) - I'm wondering what the difference is? - NickT

Esto es posible. Mira esto [Enlace] (stackoverflow.com/questions/4721449/…) - Atul Bhardwaj

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.