我使用this庫,並嘗試檢索當前位置座標如下:獲取'供應商未啓用| ProviderError {provider ='network'}'調用'tracker.startListening();'即使無線網絡啓用
settings =
new TrackerSettings()
.setUseGPS(false)
.setUseNetwork(true)
.setUsePassive(true)
.setTimeBetweenUpdates(30 * 60 * 1000);
tracker = new LocationTracker(getBaseContext(), settings) {
@Override
public void onLocationFound(Location location) {
// Do some stuff
currentLatDouble = location.getLatitude();
currentLngDouble = location.getLongitude();
}
@Override
public void onTimeout() {
}
};
tracker.startListening();
但是,我得到這個錯誤:
W/LocationTracker: Provider (network)
fr.quentinklein.slt.ProviderError: Provider is not enabled | ProviderError{provider='network'}
設備不支持WiFi網絡提供商還是我需要編寫一些與LocationManager
相關的代碼?
請讓我知道這裏有什麼問題。
檢查https://github.com/quentin7b/android-location-tracker/issues/19 – Nas
@Nas是啊,我也在那裏開了一個問題。 –
在那個庫它有android.permission.ACCESS_FINE_LOCATION只有在嘗試添加WiFi狀態訪問權限時 – Nas