Check if BlackBerry gps is enabled

北城余情 提交于 2019-12-13 05:45:15

问题


I am developing an app in which I have to check programmatically if gps is enabled or not for locations in phone? How do I find this?


回答1:


if (!LocationInfo.isLocationOn()) {
    try {
        LocationInfo.setLocationOn();
    } catch (ControlledAccessException cae) {
        // You don't have the rights to enable GPS programatically.
        // You might want to prompt the user for it.
    }
}

You might also want to have a look at the following functions:

  • LocationInfo.isLocationSourceAvailable(int mode) - Determines if a specific location source is available to provide location information.
  • LocationInfo.isLocationSourceSupported(int mode) - Determines if a specific location source is currently supported on the device.

gl




回答2:


All new BB have on device GPS. You just need to make sure it is set correctly.

First make sure you set GPS Data Source == Device GPS in the Options->Advanced Options app.



来源:https://stackoverflow.com/questions/4632907/check-if-blackberry-gps-is-enabled

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