如何知道黑莓设备是否有 GPS? [英] How to know if BlackBerry device has GPS?
本文介绍了如何知道黑莓设备是否有 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 ?
推荐答案
查看 位置提供者
.在不同情况下的一些设备上尝试此代码,我认为它应该可以工作:
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
}
这篇关于如何知道黑莓设备是否有 GPS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文