我有一个使用谷歌地图API的Android应用程序,在某些设备中,如华为里约--L03和三星Galaxy Grand Prime设置错误的位置,但在其他像摩托罗拉Moto X,HTC Desire 626它可以正常工作
有人知道为什么吗?
我真的需要帮助:(如果需要一些代码告诉我
@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 :(得分:0)
尝试调整间隔和优先级
LocationRequest mLocationRequest = LocationRequest.create();
mLocationRequest.setInterval(1000); //
mLocationRequest.setFastestInterval(1000); //
mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); //
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);