Possible Duplicate:
How can I enable or disable the GPS programmatically on Android?
I have searching on how to toggle GPS programmatically, the standard answer is that it's not possible.
If this is really the case how do all the various power/togg开发者_JAVA技巧le related widgets manage to toggle GPS with one click and no warning. The market place is full of examples that show it is possible.
So how?
I've tested this on the emulator with 1.6 and it works.
How can I enable or disable the GPS programmatically on Android?
EDIT: This is not particularly allowed on the Android Market, and it stopped working as of android 2.3. I have also tested on a 2.1 emulator, and two actual devices with 2.2, and it worked on those.
精彩评论