开发者

Determining programatically whether satellite GPS functionality is needed

Is it possible to determine programatically whether any background applications/services are using the sattelite GPS functionality? I realise from searching SO that it isn't possible to disable it in code, but that I have to use a button shortcut which does:

Intent myIntent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
startActivity(myIntent);

and click the relevant settings button.

I've written a maps application but have no access to a real phone at present and notice that the little satellite icon in the emulator's status bar doesn't reflect the state of the system setting. I'd like to try and conse开发者_StackOverflowrve battery charge and am wondering whether the GPS stays on, draining the battery, if nothing requires its functionality.

I realise that disabling satellite GPS at system level may impact other apps, hence my question.


You are confused about things.

There are disabled/enabled and radio ON/OFF states.

  • As you say only the user can disable/enable use of GPS functionality via the setting you invoke. At this time the chip is not activated, only enabled. Battery is not drained.

  • When an application starts using the GPS, the radio will go ON so the chip will be activated, battery drained.

So once your application no longer uses the GPS, just stop using it, make it radio off (unsubscribe any receivers etc..) leave it enabled, and the user might disable if he really wants.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜