Windows phone 7 关于Windows phone gap应用程序

Windows phone 7 关于Windows phone gap应用程序,windows-phone-7,cordova,Windows Phone 7,Cordova,我有这个功能 navigator.geolocation.getCurrentPosition(onSuccess,onError,{frequency:1000}) 在我的申请中。我已经为onSuccess和onError方法(参数)实现了代码 这里除了{frequency:3000}参数外,任何东西都在工作。我的代码在模拟器上显示onSuccess方法的经度和纬度。如果出现故障,请在emulator上选择onError。 但是这里的{frequency:3000}不起作用。我也使用了maxi

我有这个功能
navigator.geolocation.getCurrentPosition(onSuccess,onError,{frequency:1000})
在我的申请中。我已经为
onSuccess
onError
方法(参数)实现了代码

这里除了
{frequency:3000}
参数外,任何东西都在工作。我的代码在模拟器上显示
onSuccess
方法的经度和纬度。如果出现故障,请在emulator上选择onError。 但是这里的
{frequency:3000}
不起作用。我也使用了
maximumAge:2000
而不是频率。 我的应用程序的Moto每30秒更新一次服务器上的信息。但是
频率
最大值
不起作用。


  <!DOCTYPE html>
 <html>
 <head>
 <title>Device Properties Example</title>

 <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
 <script type="text/javascript" charset="utf-8">

// Wait for PhoneGap to load
//
  document.addEventListener("deviceready", onDeviceReady, false);

// PhoneGap is ready
  //
 function onDeviceReady() {
    navigator.geolocation.getCurrentPosition(onSuccess, onError);
}

// onSuccess Geolocation
//
  function onSuccess(position) {
    var element = document.getElementById('geolocation');
    element.innerHTML = 'Latitude: '           +  position.coords.latitude                   
   + '<br />' +
                        'Longitude: '          + position.coords.longitude                   + '<br />' +
                        'Altitude: '           + position.coords.altitude                    + '<br />' +
                        'Accuracy: '           + position.coords.accuracy                       + '<br />' +
                        'Altitude Accuracy: '  + position.coords.altitudeAccuracy              + '<br />' +
                        'Heading: '            + position.coords.heading                        + '<br />' +
                        'Speed: '              + position.coords.speed                             + '<br />' +
                        'Timestamp: '          + new Date(position.timestamp)                        + '<br />';
}

// onError Callback receives a PositionError object
//
 function onError(error) {
    alert('code: '    + error.code    + '\n' +
          'message: ' + error.message + '\n');
 }

  </script>
 </head>
 <body>
  <p id="geolocation">Finding geolocation...</p>
 </body>
  </html>
设备属性示例 //等待PhoneGap加载 // 文件。添加的监听器(“deviceready”,OnDeviceraddy,false); //PhoneGap已经准备好了 // 函数ondevicerady(){ navigator.geolocation.getCurrentPosition(onSuccess,onError); } //成功地理定位 // 成功时的功能(位置){ var element=document.getElementById('geolocation'); element.innerHTML='Latitude:'+position.coords.Latitude +“
”+ '经度:'+position.coords.Longitude+'
'+ '高度:'+position.coords.altime+'
'+ '精度:'+position.coords.accurity+'
'+ '高度精度:'+position.coords.altitudeAccuracy+'
'+ '标题:'+position.coords.Heading+'
'+ '速度:'+position.coords.Speed+'
'+ '时间戳:'+新日期(position.Timestamp)+'
'; } //OneError回调接收PositionError对象 // 函数onError(错误){ 警报('code:'+error.code+'\n'+ '消息:'+error.message+'\n'); } 查找地理位置


例如,您还可以添加以下内容:

setTimeout(“navigator.geolocation.getCurrentPosition(onSuccess,onError);”,3000)

在“OnSuccess”方法结束时,每隔3秒自动刷新geoloc数据