How to get only gps location using sencha touch?

I created a sencha touch application and I want to try to get the current location of an Android device using the code below.

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);  
    }  
   }  
  }  
});  

On my device, the gps icon will flash, but could not get the current location of the gps position of the device. It always gets the current location from my network provider.
I want to frequently update the current location from a gps device. Like the google map app for Android, the gps icon is always stable, I want it in my app.

+4
source share
2 answers

WI-FI, .
, gps.
, gps.
. .

+2

GeoLocation.

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);  
    }  
   }  
 }  
});

, Geo .

+2

Source: https://habr.com/ru/post/1531275/


All Articles