我想知道设备是否有GPS,我怎么能为v 5.0以下的设备做到这一点?
答案 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)