我是新来的Skobbler map
。在我Skobbler map
的方法中,我正在获取我当前的位置onCurrentPositionUpdate
。
SKCoordinateRegion region = new SKCoordinateRegion();
region.setCenter(currentPosition.getCoordinate());
region.setZoomLevel(13);
mapView.changeMapVisibleRegion(region, true);
因此,它显示了我当前的位置。
当我通过像这样拖动地图从当前位置移动一段距离时:
但是,在 4 或 5 秒后,它立即返回到我当前的位置。可以做些什么来停止这种运动,因为我只想在按下按钮后返回我当前的位置。在我的按钮中,我使用:
@OnClick(R.id.fab_gps)
public void goToMyGpsLocation(View view) {
if (mapView != null && currentPosition != null) {
mapView.getMapSettings().setCurrentPositionShown(true);
} else{
if(Helper.isGPSEnabled(this)){
requestCurrentPositionProvider();
}else{
Helper.alertbox("GPS not enabled", "Please enable gps before you are directed to your current location", this);
}
}
}
在我的requestCurrentPositionProvider
方法中:
public void requestCurrentPositionProvider(){
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
Permissions.requestPermission(this, LOCATION_PERMISSION_REQUEST_CODE,
Manifest.permission.ACCESS_FINE_LOCATION, true);
} else{
if(mapView != null) {
mapView.getMapSettings().setCurrentPositionShown(true);
}
if(Helper.isGPSEnabled(this)){
showSnackBar(findViewById(android.R.id.content));
currentPositionProvider = new SKCurrentPositionProvider(this);
currentPositionProvider.setCurrentPositionListener(this);
currentPositionProvider.requestLocationUpdates(MapUtils.hasGpsModule(this), MapUtils.hasNetworkModule(this), false);
}
else {
Helper.alertbox("GPS not enabled", "Please enable gps before you are directed to your current location", this);
}
诸如运动之类的东西Camera
变化如此之快。我该如何阻止它?可以在onClick
方法上做什么,以便仅在按下按钮后返回当前位置?