1

I know this question has been asked in similar forms before, but I found no real answer about the following issue:

On my Nexus One there's a widget to toggle on/off several things on my phone like wlan, bluetooth, gps,..

Why does this widget has access to the GPS, without forwarding me to the settings screen?

And how can I use this functionality in my own apps?

On many sites it is mentioned, this is done because of security reasons...but in a strage way, this widget may do this? why? and the better question is: how?

Does someone have a clue?

poeschlorn
  • 12,230
  • 17
  • 54
  • 65
  • may be widgets are specially indtended to change some settings and so have a special privileges for that? – zed_0xff Jun 07 '10 at 09:27
  • Keep in mind, that unlike Bluetooth and WiFi that setting doesn't actually turn physically the GPS on and off, it just allows apps to access the GPS position. The GPS unit doesn't actually turn on, until an app requests a position. So unless you have an app running (for example in the background) that requests the GPS positions then GPS is turned off and doesn't use any power. – RoToRa Jun 07 '10 at 09:31

1 Answers1

2

Why does this widget has access to the GPS, without forwarding me to the settings screen?

Because the widget was developed by the firmware authors, the same people who wrote the Settings screen.

And how can I use this functionality in my own apps?

You can't, as of Android 1.5. Sorry!

On many sites it is mentioned, this is done because of security reasons

Because users who ask for GPS to be disabled do not appreciate applications deciding on their own to re-enable it.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491