Mapbox-navigation-android: Android: Navigation Problem - No Movement

Created on 29 Sep 2017  路  25Comments  路  Source: mapbox/mapbox-navigation-android

I Seem To Have A Problem When Navigating, I Start The Navigation And The Navigation UI Loads With The Route, I Recieve The First Instruction And I Can See The ^ Marker On The Map. However When I Drive The Marker Just Doesn't Move, If I Stop The Navigation And Start It Again I Move To My New Location But While Driving Their Is No Movement?

Could Anybody Shed Some Light On This?

I Don't Have Any Log Files As I'm Driving When This Happens - If I Simulate The Driving Everything Works As Should.

Most helpful comment

Navigation Movement Issue Fixed.

All 25 comments

@Danny-James, can you provide code for us to see what is going on here. Sounds like an issue with the location engine not being setup correctly? If you could provide any insight on how you are doing this it would help a bunch.

I have the same problem, it was working fine until i update to v6.01 and start to use LocationLayerPlugin, after the changes the location stop working.

There is a snipped of my code used to create the navigation, LocationEngine and LocationLayer

````
@Override
public void onMapReady(MapboxMap mapboxMap) {
map = mapboxMap;
//Draw the markers from research in to the map
createMarkersFromResearch();
trafficPlugin = new TrafficPlugin(mapView, map);
trafficPlugin.setVisibility(true);

    enableLocationPlugin();

    map.setLocationSource(locationEngine);
    CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(sourcePoint)
            .zoom(17)
            .build();
    map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

   // if(map.getCameraPosition().zoom > 14)
        map.moveCamera(CameraUpdateFactory.zoomBy(17));
        map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));


    calculateRouteNavigation();
}`

` private void enableLocationPlugin() {
// Check if permissions are enabled and if not request
if (PermissionsManager.areLocationPermissionsGranted(this)) {
// Create an instance of LOST location engine
initializeLocationEngine();

        locationLayerPlugin = new LocationLayerPlugin(mapView, map, locationEngine);
        locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);

    } else {
        //TODO IMPLEMENT PERMISSION MANAGER
    }
}

private void initializeLocationEngine() {

    locationEngine = LostLocationEngine.getLocationEngine(this);
    locationEngine.setFastestInterval(500);
    locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
    locationEngine.setSmallestDisplacement(0);
    locationEngine.setInterval(0);
    locationEngine.addLocationEngineListener(this);
    locationEngine.activate();

}
@SuppressWarnings( {"MissingPermission"})
private void calculateRouteNavigation(){
    Timber.d("CalculateRouteNav", "calculou rota");
    Location userLocation = locationEngine.getLastLocation();

    if (userLocation == null) {
        Timber.d("calculateRoute: User location is null, therefore, origin can't be set.");
        Log.d("calculateRoute", "User location is null, therefore, origin can't be set");
        //return;
    }

    Position destination = positionArrayFromResearch.get(positionArrayFromResearch.size()-1);
    Position origin = positionArrayFromResearch.get(0);
    NavigationRoute.Builder navigationRouteBuilder = NavigationRoute.builder()
            .accessToken(Mapbox.getAccessToken());
    navigationRouteBuilder.origin(origin);
    navigationRouteBuilder.profile(DirectionsCriteria.PROFILE_DRIVING);
    navigationRouteBuilder.destination(destination);

    //Add all points to the route
    ArrayList<Position> auxPos = new ArrayList<>();
    for(int i = 1; i< positionArrayFromResearch.size()-2; i++){
        auxPos.add(positionArrayFromResearch.get(i));
    }
    for (Position waypoint1:positionArrayFromResearch) {

        if (waypoint1 != null) {
            navigationRouteBuilder.addWaypoint(waypoint1);
        }
    }

    //Position origin = (Position.fromCoordinates(userLocation.getLongitude(), userLocation.getLatitude()));
    if (TurfMeasurement.distance(origin, destination, TurfConstants.UNIT_METERS) < 50) {
        //mapboxMap.removeMarker(destinationMarker);
        return;
    }

    navigationRouteBuilder.build().getRoute(new Callback<DirectionsResponse>() {
        @Override
        public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) {
            Timber.d("Url: %s", call.request().url().toString());
            if (response.body() != null) {
                if (response.body().getRoutes().size() > 0) {
                    DirectionsRoute route = response.body().getRoutes().get(0);
                    MapResearchActivity.this.route = route;
                    drawRouteLine(route);
                    if (route != null){
                        Log.d("ROUTE", "ROUTE NOT NULL");

                    }else{
                        Log.d("ROUTE", "ROUTE NULL");
                    }
                    //TODO IF DOESENT WORK IMPLEMENT THE NAVIGATION MAP ROUTE
                    //navigationMapRoute.addRoute(route);

        /*for (LegStep step: route.getLegs().get(0).getSteps()) {
          mapboxMap.addMarker(new MarkerOptions().position(new LatLng(
              step.getManeuver().asPosition().getLatitude(), step.getManeuver().asPosition().getLongitude())));
         }*/
                }
            }
        }

        @Override
        public void onFailure(Call<DirectionsResponse> call, Throwable throwable) {
            Timber.e("onFailure: navigation.getRoute()", throwable);
        }
    });

/* navigation.getRoute(origin, destination, new Callback() {
@Override
public void onResponse(Call call, Response response) {
DirectionsRoute route = response.body().getRoutes().get(0);
MapResearchActivity.this.route = route;
if (route != null) Log.d("CalcRouteNavigation", "Route is not null");
if (route == null) Log.d("CalcRouteNavigation", "Route not null!!2222");
drawRouteLine(route);
navigation.startNavigation(MapResearchActivity.this.route);
if (MapResearchActivity.this.route != null) Log.d("CalcRouteNavigation", "Route not null!!2222");

        }

        @Override
        public void onFailure(Call<DirectionsResponse> call, Throwable throwable) {
            Timber.e("onFailure: navigation.getRoute()", throwable);
        }
    });*/

       // navigation.startNavigation(route);
    if(route!= null) {
        startButton.setClickable(true);
        startButton.setVisibility(View.VISIBLE);
    }
}`

`void startNavigation(){
MapboxNavigationOptions options = MapboxNavigationOptions.builder()
.defaultMilestonesEnabled(true)
.maneuverZoneRadius(MANEAVEUR_CONST)
.maxTurnCompletionOffset(MAX_TURN_COMPLETION_OFF_SET_CONST)
.snapToRoute(true)
.build();

    navigation = new MapboxNavigation(this,getString(R.string.myToken), options);

    if(navigation != null){

        startButton.setVisibility(View.INVISIBLE);

        //Create all of our navigation listeners
        createNavigationListener();
        navigation.setLocationEngine(locationEngine);
        // Attach all of our navigation listeners.
        navigation.addNavigationEventListener(navigationEventListener);
        //navigation.addOffRouteListener(offRouteListener);
        navigation.addMilestoneEventListener(milestoneEventListener);
        navigation.addProgressChangeListener(progressChangeListener);
        // from the last update.
        Toast.makeText(MapResearchActivity.this, getString(R.string.start_button), Toast.LENGTH_SHORT).show();
    }
}`

```

@cammace Basically It Was Very Simple I Made A Route See Below;

private void buildRoute() {
        // Build Route.
        NavigationRoute.Builder navigationRoute = NavigationRoute.builder();

        navigationRoute.accessToken(getString(R.string.mapbox_access_token))
                .origin(currentPosition)
                .destination(destination)
                .profile(DirectionsCriteria.PROFILE_DRIVING);

        // Add Waypoints.
        if (coOrdinates.size() > 0) {
            // Set Waypoints.
            for (String x : coOrdinates) {
                String[] coOrds = x.split(",");
                Double lat = Double.valueOf(coOrds[1]);
                Double lon = Double.valueOf(coOrds[0]);
                navigationRoute.addWaypoint(Position.fromCoordinates(lat, lon));
            }
        }
        navigationRoute.build().getRoute(this);

        loading.setVisibility(View.VISIBLE);
    }

From this I then added the route to my MapView.

@Override
    public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) {
        Log.d(TAG, "Response code: " + response.code());
        if (response.body() == null) {
            Log.e(TAG, "No routes found, make sure you set the right user and access token.");
            return;
        } else if (response.body().getRoutes().size() < 1) {
            Log.e(TAG, "No routes found");
            return;
        }

        this.route = response.body().getRoutes().get(0);

        // Print some info about the route
        Log.d(TAG, "Distance (sec): " + route.getDistance());

        // Display Route Information
        TextView textView_JourneyTime = (TextView) findViewById(R.id.textView_JourneyTime);
        TextView textView_JourneyDistance = (TextView) findViewById(R.id.textView_JourneyDistance);
        TextView textView_JourneySummary = (TextView) findViewById(R.id.textView_JourneySummary);

        textView_JourneyTime.setText(displayTravelTime(route.getDuration()));
        textView_JourneyDistance.setText(displayTravelDistance((int) route.getDistance()));
        textView_JourneySummary.setText(route.getLegs().get(0).getSteps().get(0).getManeuver().getInstruction());

        // Draw the route on the map
        navigationMapRoute = new NavigationMapRoute(navigation, mapView, this.mapboxMap);
        navigationMapRoute.addRoute(this.route);

        //drawRoute(route);
        boundCameraToRoute();
        hideLoading();
    }

I Changed The Way The Route Was Shown On The MapView By Creating A NavigationMapRoute Object. The Previous Way Of Doing This Was By Manually Drawing The Route Using the drawRoute Method;

private void drawRoute(DirectionsRoute route) {
        List<LatLng> points = new ArrayList<>();
        List<Position> coords = LineString.fromPolyline(route.getGeometry(), Constants.PRECISION_6).getCoordinates();
        for (Position position : coords) {
            points.add(new LatLng(position.getLatitude(), position.getLongitude()));
        }

        if (points.size() > 0) {

            if (polyline != null) {
                mapboxMap.removePolyline(polyline);
            }

            // Draw Points on MapView
            polyline = mapboxMap.addPolyline(new PolylineOptions()
                    .addAll(points)
                    .color(ContextCompat.getColor(this, R.color.corporateBlue))
                    .width(8));


            // Create an Icon object for the marker to use
            IconFactory mIconFactory = IconFactory.getInstance(this);
            Icon iconDestination = mIconFactory.fromResource(R.drawable.green_marker);
            Icon iconOrigin = mIconFactory.fromResource(R.drawable.blue_marker);

            // Add Destination Marker.
            mapboxMap.addMarker(new MarkerOptions()
                    .position(new LatLng(destination.getLatitude(), destination.getLongitude()))
                    .title("Destination")
                    .snippet(getIntent().getExtras().getString("DestinationAddress"))
                    .setIcon(iconDestination));

            // Add Origin Marker.
            String[] OriginCoOrds = coOrdinates.get(0).split(","); // Get Origin CoOrdinates From List.
            mapboxMap.addMarker(new MarkerOptions()
                    .position(new LatLng(Double.valueOf(OriginCoOrds[0]), Double.valueOf(OriginCoOrds[1])))
                    .title("Origin")
                    .setIcon(iconOrigin));
        }
    }

I Now Use The Following;

        // Draw the route on the map
        navigationMapRoute = new NavigationMapRoute(navigation, mapView, this.mapboxMap);
        navigationMapRoute.addRoute(this.route);

I am now trying a different way of starting the route see below my previous way of starting the route, i simply called the following;
NavigationLauncher.startNavigation(ActivityNavigationMap.this, route, null, false);

Since reading @Yanhenning I realised this may not be the correct way of starting the route, so now i create the following

//Create MapBox Navigation Options.
        MapboxNavigationOptions options = MapboxNavigationOptions.builder()
                .defaultMilestonesEnabled(true)
                .snapToRoute(true)
                .build();

        //Create MapBox Navigation Instance
        navigation = new MapboxNavigation(this, getString(R.string.mapbox_access_token), options);

And to start the route when a StartRoute Button Is Clicked I Do The Following;

   private void startNavigation(){
        if (navigation != null && route != null) {
            Log.d(TAG, "Valid Navigation/Route Object");
            navigation.setLocationEngine(locationEngine);

            // Attach all of our navigation listeners.
            navigation.addNavigationEventListener(this);
            navigation.addProgressChangeListener(this);
            navigation.addMilestoneEventListener(this);

            // Trigger StartNavigation DisplayUI.
            navigation.startNavigation(route);
        }
    }

However I Am Now Faced With Another Problem When This Method Is Run, Nothing Happens The Navigation UI Just Doesn't Show, But When I Call NavigationLauncher.startNavigation(ActivityNavigationMap.this, route, null, false); The Navigation UI Does Show Straight Away, With The Working Method, This Is Where I Had The Problem Reported, And As I Didn't Pass A LocationEngine To This I Presumed This Maybe The Problem, This Is Why I Have Changed My Implementation.

Below is my initLocationEngine.

 @SuppressWarnings({"MissingPermission"})
    private void initLocationEngine() {
        locationEngine = LostLocationEngine.getLocationEngine(this);
        locationEngine.setPriority(HIGH_ACCURACY);
        locationEngine.setInterval(0);
        locationEngine.setSmallestDisplacement(0);
        locationEngine.setFastestInterval(1000);
        locationEngine.addLocationEngineListener(this);
        locationEngine.activate();

        locationEngine.requestLocationUpdates();
        if (locationEngine.getLastLocation() != null) {
            Location lastLocation = locationEngine.getLastLocation();
            currentPosition = Position.fromCoordinates(lastLocation.getLongitude(), lastLocation.getLatitude());
        } else {
            getAndroidCurrentLocation();
            if (currentPosition.getLatitude() != 0) {
                animateCamera(new LatLng(currentPosition.getLatitude(), currentPosition.getLongitude()));
            }
        }

    }

Any Questions Please Ask.

@Yanhenning , please show youronStart() and onStop() methods, I have the same problem and looking for solution.

This is my activity lifecycle methods if required.

// Add the mapView lifecycle to the activity's lifecycle methods
    @Override
    public void onResume() {
        super.onResume();
        mapView.onResume();
    }

    @Override
    protected void onStart() {
        super.onStart();
        mapView.onStart();

        if (locationEngine != null) {
            locationEngine.addLocationEngineListener(this);
            locationEngine.activate();
        }
    }

    @Override
    protected void onStop() {
        super.onStop();
        mapView.onStop();

        if (locationEngine != null) {
            locationEngine.removeLocationEngineListener(this);
            locationEngine.removeLocationUpdates();
            locationEngine.deactivate();
        }

    }

    @Override
    public void onPause() {
        super.onPause();
        mapView.onPause();
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        mapView.onLowMemory();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        //mapView.onDestroy();

        if (locationEngine != null) {
            locationEngine.removeLocationEngineListener(this);
            locationEngine.removeLocationUpdates();
            locationEngine.deactivate();
        }

        // Remove all navigation listeners being used
        navigation.removeNavigationEventListener(this);
        navigation.removeNavigationEventListener(this);
        navigation.removeProgressChangeListener(this);
        navigation.removeOffRouteListener(this);

        // End the navigation session
        navigation.endNavigation();

        navigation.onDestroy();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        mapView.onSaveInstanceState(outState);
    }

@samvgorode heres my lifecycle methods

@Override
    @SuppressWarnings( {"MissingPermission"})
    protected void onStart() {
        super.onStart();

        mapView.onStart();
        if (locationEngine != null){
            locationEngine.addLocationEngineListener(this);
            locationEngine.activate();
        }
        if (locationLayerPlugin != null) {
            locationLayerPlugin.onStart();
        }
}
    @Override
    protected void onResume() {
        super.onResume();
        if (listenerOn) senSensorManager.registerListener(this, senAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
        mapView.onResume();
    }
    @Override
    protected void onPause() {
        super.onPause();
        if (listenerOn) senSensorManager.unregisterListener(this);
        mapView.onPause();
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();

        if (navigation != null) {
            navigation.removeMilestoneEventListener(milestoneEventListener);
            navigation.removeNavigationEventListener(navigationEventListener);
            navigation.removeProgressChangeListener(progressChangeListener);
}
        locationEngine.deactivate();
        mapView.onDestroy();
}
    @Override
    protected void onStop() {
        super.onStop();
        mapView.onStop();
        if(locationEngine != null){
            locationEngine.removeLocationEngineListener(this);
            locationEngine.deactivate();
        }
        if (locationLayerPlugin != null){
            locationLayerPlugin.onStop();
        }
    }

does anyone have a fix for this? We have another thread covering this same topic and no luck from anyone including mapbox @cammace
have sent emails direct and still nothing

Something wrong is with mapbox lifecycle methods. My navigation works, BUT only after navigation activity goes to background (onStop) and then goes to foregroung (onStart). 0.7.0-SNAPSHOT
Also methods mapView.onPause(); and mapView.onResume(); are not needed to implement from version 5.0.0

Can confirm that 6.0.1 seemingly broke Android "Real-time" movement.

@Snipedown 6.0.1? MapBox?

If Anybody Requires My Gradle File See Below

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "uk.co.ainscough.routeinfo"
        minSdkVersion 15
        targetSdkVersion 26
        multiDexEnabled true
        versionCode 2
        versionName "2.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
    maven { url 'https://maven.google.com' }
    maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile files('libs/xstream-1.4.7.jar')

    // Mapbox Maps SDK
    compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.4@aar') {
        transitive=true
        //exclude module: 'lost'
        //exclude module: 'mapbox-java-geojson'
        //exclude module: 'mapbox-android-telemetry'
    }
    compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.7.0-SNAPSHOT'
    compile 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.7.0-SNAPSHOT'
    compile 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.1.0'
    compile 'com.mapbox.mapboxsdk:mapbox-android-plugin-traffic:0.3.0'

    // Support Library Dependencies.
    compile 'com.android.support:appcompat-v7:26.0.1'
    compile 'com.android.support:design:26.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:26.0.1'

    compile 'com.google.android.gms:play-services-maps:11.0.4'
    compile 'junit:junit:4.12'

    compile 'com.jakewharton:butterknife:8.6.0'
    compile 'com.jakewharton:butterknife-compiler:8.6.0'

    // Compile MultiDex Support
    compile 'com.android.support:multidex:1.0.1'

}

@Danny-James

I was talking about commit #283 of the Navigation where they are migrating a lot of code out of NavigationView class. That's the update that broke my navigation. Looking at possible fixes until an official release.

@Danny-James @samvgorode @onsceneio

I believe I found the solution. If you are building locally and have access to the source code, go into LocationViewModel.java and find the initLocation method.

Find this part:

  locationEngine.setInterval(0);
  locationEngine.activate();

  this.locationEngine.setValue(locationEngine);


  if (locationEngine.getLastLocation() != null) {
    onLocationChanged(locationEngine.getLastLocation());
  }

All you need to do is set the location engine before activating it. Try to replace that with this:

locationEngine.setInterval(0);
this.locationEngine.setValue(locationEngine);
locationEngine.activate();

  if (locationEngine.getLastLocation() != null) {
    onLocationChanged(locationEngine.getLastLocation());
  }

@cammace could you push the above into a SNAPSHOT?

@Snipedown How do you start the NavigationUI? Like the following;

NavigationLauncher.startNavigation(ActivityNavigationMap.this, route, null, false);

Or do you build a MapBoxNavigation Object.

MapBoxNavigation navigation = new MapboxNavigation(this,getString(R.string.myToken), options);
// set locationEngine.
navigation.setLocationEngine(locationEngine);

// Attach all of our navigation listeners.
navigation.addNavigationEventListener(this);
 navigation.addProgressChangeListener(this);
navigation.addMilestoneEventListener(this);

// Trigger StartNavigation DisplayUI.
 navigation.startNavigation(route);

When doing the above the Navigation UI Doesn't Show Up - Which is the correct way of loading the NavigationUI?

@Snipedown You're correct in https://github.com/mapbox/mapbox-navigation-android/issues/284#issuecomment-334610437 -- the location engine (real not mock) for the drop-in UI is not properly activating (a regression introduced in https://github.com/mapbox/mapbox-navigation-android/pull/276). I'm working today to resolve.

Also noting this would only be an issue if you are compiling 0.7.0-SNAPSHOT

@danesfeder have you resolved location engine? As i've written above something wrong is with lificycle of location engine. My location layer marker starts updating only like this :
1.) I launch navigation activity -> start driving (real car) and marker is not moving
2.) I send app to background -> restore from background -> marker starts to update!
I use mapbox-android-navigation:0.6.2 but with 0.6.1 and 0.7.0 snapshot everything is the same.

@samvgorode This seems to have been resolved, the navigation puck moves fine since the change in 0.7.0-SNAHPSHOT - Have you cleared the depencies cache and recompiled your project?

@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        ButterKnife.bind(this);
        mapView.onCreate(savedInstanceState);
        mapView.getMapAsync(this);
        navigation = new MapboxNavigation(NavigationViewActivity.this, getString(R.string.access_token), presenter.getNaviOptions());
        navigation.addProgressChangeListener(this);
        navigation.addOffRouteListener(this);
    }
@Override
    public void onMapReady(MapboxMap mapboxMap) {
        this.mapboxMap = mapboxMap;
        initLocationEngine();
        this.mapboxMap.setOnScrollListener(this);
        this.mapboxMap.getUiSettings().setCompassEnabled(false);
        this.mapboxMap.setOnMapClickListener(point -> onClickToMap());
        initLocationLayer();
        initMapRoute();
        setMyLocationView();
    }



md5-bb55f59e0d08b05affd8d470c93591ac



private void initLocationLayer() {
        locationLayer = new LocationLayerPlugin(mapView, mapboxMap, null);
        locationLayer.setLocationLayerEnabled(LocationLayerMode.NAVIGATION);
    }



md5-bb55f59e0d08b05affd8d470c93591ac



private void initLocationEngine() {
        locationEngine = new LocationSource(this);
        locationEngine.setPriority(HIGH_ACCURACY);
        locationEngine.setInterval(0);
        locationEngine.setFastestInterval(1000);
        locationEngine.addLocationEngineListener(this);
        locationEngine.activate();

        if (locationEngine.getLastLocation() != null) {
            Location lastLocation = locationEngine.getLastLocation();
            currentPosition = Position.fromCoordinates(lastLocation.getLongitude(), lastLocation.getLatitude());
getRoute(currentPosition);
        }
    }



md5-bb55f59e0d08b05affd8d470c93591ac



 void getRoute(Position currentPosition) {
        NavigationRoute.builder()
                .accessToken(Mapbox.getAccessToken())
                .origin(currentPosition)
                .destination(to)
                .build()
                .getRoute(this);
    }



md5-bb55f59e0d08b05affd8d470c93591ac



    @Override
    public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) {
        if (validRouteResponse(response)) {
            DirectionsRoute route = response.body().getRoutes().get(0);
            allRouteDistanceTime = route.getDuration();
            if(mapRoute.getRoute()!=null)mapRoute.removeRoute();
            mapRoute.addRoute(route);
            navigation.setLocationEngine(locationEngine);
            navigation.startNavigation(route);
        }
    }

@samvgorode Are you not using the Navigation UI? are you building the navigation yourself?

The way i launch the Navigation with a route is like below

NavigationLauncher.startNavigation(this, route, null, false)

@Danny-James I have a custom navigation activity.

@samvgorode this was only a issue in the UI and I believe should be resolved like @Danny-James mentioned.

At a glance, I see you haven't included your onConnected() method from LocationEngineListener - please make sure you call locationEngine.requestLocationUpdates() inside that method.

In onConnected I do exactly as you have mentioned.

Yesterday we released a new patch release in the 0.6.x series with a focus on stability fixes https://github.com/mapbox/mapbox-navigation-android/issues/385. Do you still observe any issues after upgrading?

i have the same problem that @samvgorode had, i upgraded my project and still the same

@samvgorode @Yanhenning From reading this thread, looks like you both are hitting an issue using the Location Layer Plugin. This is a plugin for which we have a test app that showcases the basic functionality of the plugin. When you have a chance, could you:

  1. Check the location-specific activities and see if you can reproduce the issue there as well? This could indicate an issue with the plugin itself, or with a particular device.

  2. If not, could you try reproducing your issue modifying the code of this test app? We're having trouble seeing your problem and this approach would greatly help isolate the issue.

Thanks again everyone for your feedback.

Navigation Movement Issue Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trinhvanminh2009 picture trinhvanminh2009  路  5Comments

carstenhag picture carstenhag  路  8Comments

Guardiola31337 picture Guardiola31337  路  5Comments

headbanggg picture headbanggg  路  5Comments

Danny-James picture Danny-James  路  4Comments