Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使用sencha touch仅获取gps位置?_Android_Gps_Sencha Touch 2 - Fatal编程技术网

Android 如何使用sencha touch仅获取gps位置?

Android 如何使用sencha touch仅获取gps位置?,android,gps,sencha-touch-2,Android,Gps,Sencha Touch 2,我已经创建了SenchaTouch应用程序,我想尝试使用下面的代码获取android设备的当前位置 Ext.create('Ext.util.Geolocation', autoUpdate: true, allowHighAccuracy: true, listeners: { locationupdate: function(geo) { latitude=geo.position.coords.latitude; longitude=geo.posi

我已经创建了SenchaTouch应用程序,我想尝试使用下面的代码获取android设备的当前位置

Ext.create('Ext.util.Geolocation',  
autoUpdate: true,  
allowHighAccuracy: true,  
listeners: {  
locationupdate: function(geo) {  
    latitude=geo.position.coords.latitude;  
    longitude=geo.position.coords.longitude;  
    if(Global.currentUserPositionMarker)  
    {  
        latlng1=new google.maps.LatLng(latitude, longitude);  
        currentPosMarker.setPosition(latlng1);  
    }  
   }  
  }  
});  
在我的设备中,gps图标将闪烁,但无法获取设备gps位置的当前位置。 它总是从我的网络提供商处获取当前位置。
我想经常从设备gps位置更新当前位置。
像android的谷歌地图应用程序一样,gps图标总是稳定的,我想在我的应用程序中这样做。

启动你的设备WI-FI,然后尝试加载你的应用程序。
因为从gps获取当前位置对我很有用。
从gps获取当前位置时,我也面临同样的问题。

我还为这些问题添加了相关问题。

在地理定位对象中添加频率参数

Ext.create('Ext.util.Geolocation',  
autoUpdate: true,
frequency:1000,  
allowHighAccuracy: true,  
listeners: {  
locationupdate: function(geo) {  
    latitude=geo.position.coords.latitude;  
    longitude=geo.position.coords.longitude;  
    if(Global.currentUserPositionMarker)  
    {  
        latlng1=new google.maps.LatLng(latitude, longitude);  
        currentPosMarker.setPosition(latlng1);  
    }  
   }  
 }  
});

频率值以毫秒为单位,用于按给定时间更新地理位置

我在geolocaion中使用了频率参数,我也给出了频率:1,但直到我的图标快速闪烁。