如何知道如果BlackBerry设备具有GPS? [英] How to know if BlackBerry device has GPS?

查看:137
本文介绍了如何知道如果BlackBerry设备具有GPS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,如果该设备具有GPS或没有,我怎么能做到这一点对于低于V 5.0的设备?

I want to know if the device has GPS or not, how could I do that for the devices below v 5.0 ?

推荐答案

有一个在文档的<一个href=\"http://www.blackberry.com/developers/docs/4.6.0api/javax/microedition/location/LocationProvider.html\"相对=nofollow> 位置提供商 。尝试在不同的情况下,一些设备,这个code和我认为它应该工作:

Have a look at docs for Location Provider. Try this code on a few devices in different situations and I think it should work:

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
}

这篇关于如何知道如果BlackBerry设备具有GPS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆