大佬教程收集整理的这篇文章主要介绍了ios – Phonegap,Cordova watchposition火力每1秒成功一次,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图解决R_197_6193@gap / Cordova使用Navigator.geoLOCATIOn.watchPosition的方式.@H_450_7@
文档说,选项“maximumAge”是要求系统检索位置的选项.@H_450_7@
所以有这些选择:@H_450_7@
{ maximumAge: 3000,timeout: 5000,enableHighAccuracy: true }
我认为位置请求会每3秒触发一次?@H_450_7@
无论什么样的最大值,我都会每1秒钟取一次成功…@H_450_7@
有人可以解释一下吗?@H_450_7@
谢谢再见
抢@H_450_7@
// call this once setupWatch(3000); // sets up thE interval at the specified frequency function setupWatch(freq) { // global var here so it can be cleared on logout (or whenever). activeWatch = seTinterval(watchLOCATIOn,freq); } // this is what gets called on thE interval. function watchLOCATIOn() { var gcp = navigator.geoLOCATIOn.getCurrentPosition( updateUserLoc,onLOCATIOnError,{ enableHighAccuracy: true }); // console.log(gcp); } // do something with the results function updateUserLoc(position) { var LOCATIOn = { lat : position.coords.latitude,lng : position.coords.longitude }; console.log(LOCATIOn.lat); console.log(LOCATIOn.lng); } // stop watching function logout() { clearInterval(activeWatch); }
以上是大佬教程为你收集整理的ios – Phonegap,Cordova watchposition火力每1秒成功一次全部内容,希望文章能够帮你解决ios – Phonegap,Cordova watchposition火力每1秒成功一次所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。