2017-04-17 53 views
-3

我有一個Android應用程序,使用谷歌地圖API,在華爲Rio - L03和三星Galaxy Grand Prime等設備設置錯誤的位置,但在其他像摩托羅拉Moto X,HTC慾望626它正常工作谷歌地圖API Android在某些設備中的錯誤位置

有人知道爲什麼嗎?

我真的需要幫助:(如果需要一些代碼,告訴我

@Override 
public void onLocationChanged(Location location) { 
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); 

mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); 
mMap.animateCamera(CameraUpdateFactory.zoomTo(15)); 

//Remove location updates for only set it one time 
if (gpsSettings.mGoogleApiClient != null)    
LocationServices.FusedLocationApi.removeLocationUpdates(gpsSettings.mGoogleApiClient, this); 
} 
+0

哪來的代碼? – ZeroOne

+0

我更新了它,我@ZeroOne希望能幫到你我,謝謝! –

回答

0

儘量調整時間間隔和優先

LocationRequest mLocationRequest = LocationRequest.create(); 
mLocationRequest.setInterval(1000); // 
mLocationRequest.setFastestInterval(1000); // 
mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); // 

LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this); 
+0

謝謝,我會嘗試 –