【问题标题】:Current location pointer is jumping i dump to resolve the issue当前位置指针正在跳转我转储以解决问题
【发布时间】:2016-04-06 15:12:39
【问题描述】:

当前位置指针正在跳转我转储以解决问题。我想停止跳转当前指针指针。我想显示指针而不跳转情况。 我尝试了 4 天,但没有完成此任务。

 private boolean initMap() {
    if (mMap == null && FirstTimeMapIniciate == 0) {
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
        mMap = mapFragment.getMap();
        mMap.setMyLocationEnabled(true);
        mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);


    }
    return (mMap != null);
}

这是 OnLocationChange 代码

 @Override
public void onConnected(Bundle bundle) {
    Toast.makeText(this, "Ready to map!", Toast.LENGTH_SHORT).show();

    mListener = new LocationListener() {
        @Override
        public void onLocationChanged(Location location) {
            latitude = location.getLatitude();
            longitude = location.getLongitude();
            LatLng latLng1 = new LatLng(latitude, longitude);
            MarkerOptions mp = new MarkerOptions();
            mp = new MarkerOptions();
            mp.position(new LatLng(location.getLatitude(),
                    location.getLongitude()));
            mMap.setMyLocationEnabled(true);

            // mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
            Toast.makeText(MainActivity.this, "Location : " + location.getLatitude() + ", " + location.getLongitude(), Toast.LENGTH_LONG).show();
            if (FirstTimeMapIniciate == 0) {
                gotoLocation(location.getLatitude(), location.getLongitude(), 15);

                FirstTimeMapIniciate = 1;

            }
            AppUtill.UniqueId();
            new JSONAsyncTask().execute("http://103.8.7/hajjapi/api/GPSLocator/GetLocations");

            if (AppStatus.getInstance(getContext()).isOnline()) {


            } else {

                Toast.makeText(MainActivity.this, "Turn On your WIFI ", Toast.LENGTH_LONG).show();

            }

         /*   if (marker != null) {
                marker.remove();

            }*/


        }
    };
    LocationRequest request = LocationRequest.create();
    request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    request.setInterval(1000);
    request.setFastestInterval(1000);
    LocationServices.FusedLocationApi.requestLocationUpdates(mLocationClient, request, mListener);
}

【问题讨论】:

  • 请任何人帮助我...
  • 请帮帮我.......

标签: android performance shell android-layout android-fragments


【解决方案1】:

您的逻辑中有几个问题,首先您不需要在每次位置更新时调用 setMyLocationUpdate(true)。 正如我所说,您的问题的答案是您需要实现自己的服务,您可以在其中应用自定义算法来过滤掉这些跳跃。

【讨论】:

    猜你喜欢
    • 2023-03-18
    • 2015-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 2020-08-28
    • 1970-01-01
    相关资源
    最近更新 更多