我使用插件cordova-plugin-geolocation。我唯一的问题是,信息提示,让位置看起来是这样的:科尔多瓦iOS位置消息
/var/container/bundle/application/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/my_project/www/index.html 想使用您的位置。
反正有什么东西一点点性感,像
MY_PROJECT想使用您的位置
干杯。
添加一些代码,对于非信徒
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
navigator.geolocation.getCurrentPosition(onLocationSuccess, onLocationError, {maximumAge:3000, timeout:2000, enableHighAccuracy:true});
function onLocationSuccess(){
}
function onLocationError(){
}
}
的地理定位插件应自动照顾这对你。确保在你的第一个GPS请求之前等待'deviceready' - 否则你将得到浏览器的实现,而不是插件的实现。 –
我想为ondevice准备好已经 – Eric
有助于看到一些代码。 –