我想在锁定屏幕上显示许多位置。我测试过,只显示了10个位置。有没有办法显示超过10个位置?
答案 0 :(得分:1)
Rachel的正确之处在于,Passbook只能识别pass.json中包含的前10个位置。如果有超过10个,那么这些将被忽略。
您链接到的解决方法,提出以下建议:
根据您想要确定最合适位置的复杂程度,可能会有一些工作。它也不能提供良好的用户体验,因为该位置将吃电池并且不断更新通行证会吃掉数据。
三种替代方法是:
http://www.yourservice.com/?passSerial=xxxx
示例位置JS:
<script>
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(success,fail);
}
function success(a) {
$("#long").val(a.coords.longitude).focus(); // focus required to force an update of the field value in webkit browsers
$("#lat").val(a.coords.latitude).focus();
// initiate ajax callback to push new pass and alert the user that it is on the way
}
function fail() {
alert("You must give permission to provide your location, please refresh this page and try again");
}
</script>