Redraw route on map when user changes driving route - android

I'm working on an Android App which draws path on map using Polyline options, between source to destination.
This works fine.
What I need is, if user starts from source, and instead of taking drawn route towards destination, the user takes another route, the path on map should be redrawn for user's current path.
I'm using Directions API for drawing path.
I think, I'm required to use Google Navigation API. How can use that within my app, without having to navigate to Google Maps app?

First: Check if your current/last known location is near or falls on the path/route created.
Direction api: check if a place falls in the route path between 2 places
Second: If current/ last known location if outside or off the path/route created, send a request to get direction from the current location to the same destination.
OR
Try this
Turn by Turn navigation

Related

On road checking using Osm map

Hi i have turn by turn navigation app using osm map.
I can show the road path from source to destination but how can i check the current position(GPS) is within the road or away while traveling in a car.
this is the link i am using to get road path
OSRMRoadManager.getRoad:http://router.project-osrm.org/viaroute?&loc=19.112745999999998,73.00902099999999&loc=18.651449,73.344726&instructions=true&alt=false.
Edit:
I need to alert the user if he get diverted from the selected rout.

How to keep updating the displayed route obtained through Google Directions API as user moves towards the destination?

I obtained driving directions to a destination in my Android app. Now as the user progresses towards the destination on this route, I want to hide the portion of the route already covered and update the remaining distance. Also, if the users strays from the route that is currently being displayed, I want to recalculate the driving directions to the destination from the user's new location.
Can anyone suggest how I should approach this? Should I keep searching for user's location coordinates in the calculated route or is there a better way of doing this?

Step by Step Driving instructions using google maps API v2 and directions API?

I have created an app which has a navigation drawer listing possible destinations. By selecting one of the destinations, the starting location is obtained using location manager, and the destination location is hardcoded. I can successfully draw polyline between the origin and destination by obtaining JSON output from the url. What I want now is I put a couple of textviews in the botton to show step by step instructions like turn right here, turn left there. Is there any way to obtain this information using the above given APIs?
I tried to search All I get is how to draw polyline from parsed data.
Try this http://maps.googleapis.com/maps/api/directions/json?origin=5th%20Ave&destination=Times%20Square&mode=bicycling&sensor=false
Here ,in the json response there is a tag:maneuver you can use this for your need

Draw path on google map during Driving/Walking

I am working on the application that require the draw the path on the google map. Here Starting point is the current location(latitude and langitude) of the user and when user change the place(walking/Driving) then as per the moving position get the user's current location(latitude and langitude) and draw the path on the google map as per the user's location.
I able to draw path between fix point.For that I am refer this LINK.
Thanks.
Use the Android Location API an example: http://www.vogella.com/articles/AndroidLocationAPI/article.html
and when you get your position, send the coordinates to google maps with an overlay for example.

Reverse Geocoding in Android : Error "IOException:Service not Available"

My app is totally based on maps. The requirement is user need to enter the source and destination in words then i need to draw the route on map with those values with markers. Later on the displayed map with route drawn, the user able to change/modify the source or destination by dragging the marker which are displayed. Simultaneously the route drawn should also change dynamically with user's action.
I can get the lat & long from the map using onTouchEvent. But in the same map not able to set both source and destination.
And i tried reverse geocoding to get the lat & lon from given location names. But i get IOException:Service not Available. I was searching for solution, then i found this link which started in jun 2010, still no fix for this bug till now.
Please help.Also provide sample code.
Thanks.

Categories

Resources