Enable GPS without forwarding the user to “settings”?

北城余情 提交于 2019-12-13 17:59:45

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/2988314/enable-gps-without-forwarding-the-user-to-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!