-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OnProgressChange and OnLocationChanged not working #781
Comments
Hey @A1ecm, thanks for the feedback here - are you using these listeners in conjunction with |
Yes, this is my NavigationLauncher code: `
Thanks for the response |
@A1ecm Unfortunately, this is an existing bug with the This is currently confusing because Using the |
Thanks for the solution, does this mean i have to make two seperate fragments or can i use the |
@A1ecm You can use |
I implemented it like this: ` @OverRide
But the "this" in the builder cannot be applied. Any insights? |
@A1ecm |
It works, thank you so much! I have one last thing i'm going to bother you with. I can't seem to find the right place to place this code for ending the navigation. |
Question @A1ecm, did you end up creating two separate activities? The main activity having the mapview and the navigation activity holding the navigationview? |
@A1ecm you need to make sure |
I followed the android navogation app tutorial on the mapbox website and got it working. Now i want to implement an OnProgressChange method, but it is not being called. I read somewhere that it could be because speed is 0, so i made an OnLocationChanged method to print the speed to see what the values is. But the OnLocationChanged method is also not being called. I am using com.mapbox.mapboxsdk:mapbox-android-navigation:0.11.1, my minSdkVersion is 15 and my targetSdkVersion is 26.
Here is my code for both methods:
@Override public void onProgressChange (Location location, RouteProgress routeProgress){ Toast.makeText(getBaseContext(), "Progress changing ", Toast.LENGTH_SHORT).show(); Toast.makeText(getBaseContext(), "Distance remaining: " + stepDistanceRemaining, Toast.LENGTH_SHORT).show(); if (stepDistanceRemaining < 50) { Log.i(TAG, "NextStepComing"); sendManeuver(routeProgress); } }
@Override public void onLocationChanged(Location location) { String speed = String.format("%d\nMPH", (int) (location.getSpeed() * 2.2369)); Toast.makeText(getBaseContext(), "Speed: " + speed, Toast.LENGTH_SHORT).show(); if (location != null) { originLocation = location; setCameraPosition(location); } }
The text was updated successfully, but these errors were encountered: