0

Possible Duplicate:
enabling GPS programmatically not working

I am making this app, where i need to turn on the GPS by reading a special code in an incoming message and send its GPS location(long, lat) to the sender. So i need to know how to enable GPS through coding without using any user interface.

Community
  • 1
  • 1

1 Answers1

0

Use a service launched from the BroadcastReceiver (the one you use to detect incoming SMS). The calls are the same. If you really need GPS coordinates (network isn't good enough), you'll need to call requestLocationUpdates on LocationManager and wait for the GPS to synch and call your listener. I've done the same thing for an app once, worked just fine.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127