黑莓代码,用于检查手机中GPS是打开还是关闭

时间:2011-01-17 13:36:53

标签: blackberry-eclipse-plugin

我希望代码检查手机中的GPS是否打开或关闭?

1 个答案:

答案 0 :(得分:2)

使用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
}

信用:aligf

Similar Question.