如何知道BlackBerry设备是否有GPS?

时间:2010-12-09 17:00:55

标签: blackberry geolocation

我想知道设备是否有GPS,我怎么能为v 5.0以下的设备做到这一点?

2 个答案:

答案 0 :(得分:4)

查看Location Provider的文档。在不同情况下的几台设备上试用这段代码,我认为它应该可行:

try {
    LocationProvider lp = LocationProvider.getInstance(null);
    if (lp == null) {
        //Device doesn't currently have GPS enabled
    } else {
        //Device has GPS enabled
    }
} catch (LocationException le) {
     //Device's GPS is currently permanently disabled
}

答案 1 :(得分:0)