Android - Can I set first priority to GPS to get current location in google map?

旧街凉风 提交于 2019-12-05 02:58:09

问题


I want to configure location settings such a way that first priority to get current location using GPS, If GPS is not available than get network provider's location otherwise not.

Currently I am getting netwrok provider's settings only.

I have set android menifest as below:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />

Sencha code to get GEO location:

Ext.create('Ext.util.Geolocation',  
    autoUpdate: true,  
    allowHighAccuracy: true,  
    frequency: '3000',  
    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);  
        }  
    }  
 }  
});

I am using sencha 2.3.1, phonegap 2.8.0, android sdk 4.4.2 (API 19).

来源:https://stackoverflow.com/questions/22227147/android-can-i-set-first-priority-to-gps-to-get-current-location-in-google-map

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!