【发布时间】:2014-10-28 09:34:37
【问题描述】:
我已成功使用此 (https://github.com/apache/cordova-plugin-geolocation) 为科尔多瓦实施地理定位,但是手机中的 gps 已关闭 onerror 功能从未被调用。是否有其他方法可以检查 gps 是否打开或关闭.这是我的代码
navigator.geolocation.getCurrentPosition(function (position) {
//getting location
lat=position.coords.latitude;
long=position.coords.longitude;
}, function (error) {
//when gps is off it is never executed
alert('Unable to get location: ' + error.message);
});
更新
onerror 在 SONY XPERIA T 中执行,但在其他设备(Micromax、Samsung、Motog)中不执行
【问题讨论】:
标签: android angularjs cordova gps