In this article, we will develop an Android application which facilitates users to tap two locations in the Google Map. On taping the second point, a driving route will be drawn in the Google Map Android API V2 using Google Directions API.
This application is developed in Eclipse (4.2.1) with ADT plugin (21.1.0) and Android SDK (21.1.0) and tested in a real device (Android 2.3.6 - GingerBread ).
1. Create a new Android application project namely “LocationRouteDirectionMapV2″
2. Configure the project
3. Design application launcher icon
4. Create a blank activity
5. Enter MainActivity details
6. Download and configure Google Play Services Library in Eclipse
Google Map for Android is now integrated with Google Play Services. So we need to set up Google Play Service Library for developing Google Map application in Android.
Please follow the given below link to setup Google Play Service library in Eclipse.
http://developer.android.com/google/play-services/setup.html
Note : Please ensure that, the latest version of Google Play Service Library is installed
7. Add Google Play Services Library to this project
8. Get the API key for Google Maps Android API V2
We need to get an API key from Google to use Google Maps in Android application.
Please follow the given below link to get the API key for Google Maps Android API v2.
https://developers.google.com/maps/documentation/android/start
9. Add Android Support library to this project
By default, Android support library (android-support-v4.jar ) is added to this project by Eclipse IDE to the directory libs. If it is not added, we can do it manually by doing the following steps :
- Open Project Explorer by Clicking “Window -> Show View -> Project Explorer”
- Right click this project
- Then from popup menu, Click “Android Tools -> Add Support Library “
10. Update the layout file res/layout/activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <fragment android:id="@+id/map" android:layout_width="wrap_content" android:layout_height="wrap_content" class="com.google.android.gms.maps.SupportMapFragment" /> </RelativeLayout>
11. Create a new class namely “DirectionsJSONParser” in the file src/in/wptrafficanalyzer/locationroutedirectionmapv2/DirectionsJSONParser.java
package in.wptrafficanalyzer.locationroutedirectionmapv2; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.google.android.gms.maps.model.LatLng; public class DirectionsJSONParser { /** Receives a JSONObject and returns a list of lists containing latitude and longitude */ public List<List<HashMap<String,String>>> parse(JSONObject jObject){ List<List<HashMap<String, String>>> routes = new ArrayList<List<HashMap<String,String>>>() ; JSONArray jRoutes = null; JSONArray jLegs = null; JSONArray jSteps = null; try { jRoutes = jObject.getJSONArray("routes"); /** Traversing all routes */ for(int i=0;i<jRoutes.length();i++){ jLegs = ( (JSONObject)jRoutes.get(i)).getJSONArray("legs"); List path = new ArrayList<HashMap<String, String>>(); /** Traversing all legs */ for(int j=0;j<jLegs.length();j++){ jSteps = ( (JSONObject)jLegs.get(j)).getJSONArray("steps"); /** Traversing all steps */ for(int k=0;k<jSteps.length();k++){ String polyline = ""; polyline = (String)((JSONObject)((JSONObject)jSteps.get(k)).get("polyline")).get("points"); List<LatLng> list = decodePoly(polyline); /** Traversing all points */ for(int l=0;l<list.size();l++){ HashMap<String, String> hm = new HashMap<String, String>(); hm.put("lat", Double.toString(((LatLng)list.get(l)).latitude) ); hm.put("lng", Double.toString(((LatLng)list.get(l)).longitude) ); path.add(hm); } } routes.add(path); } } } catch (JSONException e) { e.printStackTrace(); }catch (Exception e){ } return routes; } /** * Method to decode polyline points * Courtesy : http://jeffreysambells.com/2010/05/27/decoding-polylines-from-google-maps-direction-api-with-java * */ private List<LatLng> decodePoly(String encoded) { List<LatLng> poly = new ArrayList<LatLng>(); int index = 0, len = encoded.length(); int lat = 0, lng = 0; while (index < len) { int b, shift = 0, result = 0; do { b = encoded.charAt(index++) - 63; result |= (b & 0x1f) << shift; shift += 5; } while (b >= 0x20); int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lat += dlat; shift = 0; result = 0; do { b = encoded.charAt(index++) - 63; result |= (b & 0x1f) << shift; shift += 5; } while (b >= 0x20); int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lng += dlng; LatLng p = new LatLng((((double) lat / 1E5)), (((double) lng / 1E5))); poly.add(p); } return poly; } }
12. Update the class “MainActivity” in the file src/in/wptrafficanalyzer/locationroutedirectionmapv2/MainActivity.java
package in.wptrafficanalyzer.locationroutedirectionmapv2; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.json.JSONObject; import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.Menu; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnMapClickListener; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.PolylineOptions; public class MainActivity extends FragmentActivity { GoogleMap map; ArrayList<LatLng> markerPoints; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initializing markerPoints = new ArrayList<LatLng>(); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment fm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); // Getting Map for the SupportMapFragment map = fm.getMap(); if(map!=null){ // Enable MyLocation Button in the Map map.setMyLocationEnabled(true); // Setting onclick event listener for the map map.setOnMapClickListener(new OnMapClickListener() { @Override public void onMapClick(LatLng point) { // Already two locations if(markerPoints.size()>1){ markerPoints.clear(); map.clear(); } // Adding new item to the ArrayList markerPoints.add(point); // Creating MarkerOptions MarkerOptions options = new MarkerOptions(); // Setting the position of the marker options.position(point); /** * For the start location, the color of marker is GREEN and * for the end location, the color of marker is RED. */ if(markerPoints.size()==1){ options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); }else if(markerPoints.size()==2){ options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)); } // Add new marker to the Google Map Android API V2 map.addMarker(options); // Checks, whether start and end locations are captured if(markerPoints.size() >= 2){ LatLng origin = markerPoints.get(0); LatLng dest = markerPoints.get(1); // Getting URL to the Google Directions API String url = getDirectionsUrl(origin, dest); DownloadTask downloadTask = new DownloadTask(); // Start downloading json data from Google Directions API downloadTask.execute(url); } } }); } } private String getDirectionsUrl(LatLng origin,LatLng dest){ // Origin of route String str_origin = "origin="+origin.latitude+","+origin.longitude; // Destination of route String str_dest = "destination="+dest.latitude+","+dest.longitude; // Sensor enabled String sensor = "sensor=false"; // Building the parameters to the web service String parameters = str_origin+"&"+str_dest+"&"+sensor; // Output format String output = "json"; // Building the url to the web service String url = "https://maps.googleapis.com/maps/api/directions/"+output+"?"+parameters; return url; } /** A method to download json data from url */ private String downloadUrl(String strUrl) throws IOException{ String data = ""; InputStream iStream = null; HttpURLConnection urlConnection = null; try{ URL url = new URL(strUrl); // Creating an http connection to communicate with url urlConnection = (HttpURLConnection) url.openConnection(); // Connecting to url urlConnection.connect(); // Reading data from url iStream = urlConnection.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(iStream)); StringBuffer sb = new StringBuffer(); String line = ""; while( ( line = br.readLine()) != null){ sb.append(line); } data = sb.toString(); br.close(); }catch(Exception e){ Log.d("Exception while downloading url", e.toString()); }finally{ iStream.close(); urlConnection.disconnect(); } return data; } // Fetches data from url passed private class DownloadTask extends AsyncTask<String, Void, String>{ // Downloading data in non-ui thread @Override protected String doInBackground(String... url) { // For storing data from web service String data = ""; try{ // Fetching the data from web service data = downloadUrl(url[0]); }catch(Exception e){ Log.d("Background Task",e.toString()); } return data; } // Executes in UI thread, after the execution of // doInBackground() @Override protected void onPostExecute(String result) { super.onPostExecute(result); ParserTask parserTask = new ParserTask(); // Invokes the thread for parsing the JSON data parserTask.execute(result); } } /** A class to parse the Google Places in JSON format */ private class ParserTask extends AsyncTask<String, Integer, List<List<HashMap<String,String>>> >{ // Parsing the data in non-ui thread @Override protected List<List<HashMap<String, String>>> doInBackground(String... jsonData) { JSONObject jObject; List<List<HashMap<String, String>>> routes = null; try{ jObject = new JSONObject(jsonData[0]); DirectionsJSONParser parser = new DirectionsJSONParser(); // Starts parsing data routes = parser.parse(jObject); }catch(Exception e){ e.printStackTrace(); } return routes; } // Executes in UI thread, after the parsing process @Override protected void onPostExecute(List<List<HashMap<String, String>>> result) { ArrayList<LatLng> points = null; PolylineOptions lineOptions = null; MarkerOptions markerOptions = new MarkerOptions(); // Traversing through all the routes for(int i=0;i<result.size();i++){ points = new ArrayList<LatLng>(); lineOptions = new PolylineOptions(); // Fetching i-th route List<HashMap<String, String>> path = result.get(i); // Fetching all the points in i-th route for(int j=0;j<path.size();j++){ HashMap<String,String> point = path.get(j); double lat = Double.parseDouble(point.get("lat")); double lng = Double.parseDouble(point.get("lng")); LatLng position = new LatLng(lat, lng); points.add(position); } // Adding all the points in the route to LineOptions lineOptions.addAll(points); lineOptions.width(2); lineOptions.color(Color.RED); } // Drawing polyline in the Google Map for the i-th route map.addPolyline(lineOptions); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
13. Update the file AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="in.wptrafficanalyzer.locationroutedirectionmapv2" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.INTERNET"/> <permission android:name="in.wptrafficanalyzer.locationroutedirectionmapv2.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="in.wptrafficanalyzer.locationroutedirectionmapv2.permission.MAPS_RECEIVE" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="in.wptrafficanalyzer.locationroutedirectionmapv2.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="YOUR_API_KEY"/> </application> </manifest>
Note : Replace “YOUR_API_KEY” at the line 46 with the API key obtained in Step 8
14. Screenshot of the application
15. Download Source Code


I am George Mathew, working as software architect and Android app developer at wptrafficanalyzer.in
You can hire me on hourly basis or on project basis for Android applications development.
For hiring me, please mail your requirements to info@wptrafficanalyzer.in.
My other blogs
store4js.blogspot.com
Thanks
sir thannnnnnnnnxx alot, i was looking for this tutorial from past few weeks, no one has so informative tut like yours…
very helpful
very useful tutorial. but i want to ask you, how do I know distance traveled and a travel time to a destination specified by the user?
I hope to find out information quickly.
once again, I say many thanks.
Please see the article given below :
Driving distance and travel time duration between two locations in Google Map Android API V2
hi. thanks for this tutorial. If i want calculate the shortest path. Can u help me?
i got null pointer exception on this code…give any sollutions
error at line map.setMyLocationEnabled(true); null point ecxeption what is the solution
Please ensure that, the project is linked to Google Play Services library correctly
yes it`s linked with Google Play service but showing warning + error also “Google play store missing” i found solution on other link they are installed gsm.apk ,vending.apk file on emulator it`s correct i tried but didn`t get any correct solution.
Do you know how i can show the local traffic??
i want to draw route using source, way poins and destination
Please see the article titled “Route between two locations with waypoints in Google Map Android API V2“
i changed the API key and still the map doesn’t show
Also here. I change my API KEY but the map doesn’t show.
Very easy. Congrats!
When I tried to implement this code, i get an error in following lines
1. setContentView(R.layout.activity_main);
R cannot be resolved to a variable
2. SupportMapFragment fm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);
3. getMenuInflater().inflate(R.menu.activity_main, menu);
Please help in finding the errors and what change to be done in code to make it working,
Hi Vhinesh,
Please try the following :
=> Ensure that, there are no errors in the file activity_main.xml
=> Clean and rebuild the project ( In Eclipse IDE, Project => Clean )
=> Ensure that, Android support library is added to this project ( check for the file “android-support-v4.jar” in the “libs” folder )
thank you…very much sir,now i resolved the errors,but as i installed the app in my phone and try to open it is closing automatically say “unfortunately closed”…can you help me with this….thank you in advance
Please check your logcat to get some hint on the error
Hello Sir,
I wanted to integrate your this project with the project displaying the nearby places like ATM. how do i combine both? both the projects contain same functions and classes.? Please help
Hello sir : Tank you very much for you’re efforts. unfortunately when i imported the project and i put the key provided by google api i run but it gives me an alert ” unfortunately LocationRouteDirectionMapv2 has stopped ” I need help please
Thanks alot for the tutorial. May God Bless you
1-Failed to load map. Could not contact Google servers this error appear to me although map show from i write this code
2-please i need (driving route) from my current location to another location
please i want when determine my location and with another static latlng of another location it can route drive routr between them ,thanks in advance
Hi Eman,
Please refer the article titled “Driving route from my location to destination in Google Maps Android API V2“
thanks, but i want from my changed location to another location i used atutorial but it contain error i can’t fix it
Hi, I tried to application but I have error. Error is null pointer exception.Please can u help me?
please give me the source code for driving route from current location to given input city name
Awesome. It works perfectly. The next what i want to do is create some progress bar while information is proccessing (it did relatively fast
).
Thank you for share.
Is this code works on 2.3.3 android version . i tried it but showing layoutinflater error and classnotfound exception showing please help me on this
Thanks
Devendar
Good Evening, I have tried the app “Drawing route driving directions between two locations using Google Directions in Android Google Map API V2″ and succeed. I would like to combine with Hill Climbing method to search the nearest distance. whether it can be implemented? I’ve tried but still confused combine between this app n Hill climbing method. thank you
Great…! can i use this source code APK file in my 2.3.6 api Android Samsung mobile phone.?
I got force to close message in my android phone. please help me to solve this prob.
Tank you very much for you’re efforts. unfortunately when i imported the project and i put the key provided by google api i run but it gives me an alert ” unfortunately LocationRouteDirectionMapv2 has stopped ” I need help please
nice tutorial, but i want to ask you, how to combine this tutorial with your tutorial “Android Geocoding – Showing User Input Location on Google Map Android API V2″ ??
I hope to find out information quickly.
once again, I say many thanks.
Hello Sir,
I would like to develop Map Tracker view like Open GPS Map Tracker. How can I develop this please produce one of the tutorial on the basis of that.
Thanks.
I want to mark my second position as current to dram route from the location where i first clicked upto the current location where i am present, how can i?
Hi,
Please refer the given below article :
http://wptrafficanalyzer.in/blog/driving-route-from-my-location-to-destination-in-google-maps-android-api-v2/
Hello
I have tried this tutorial to run on EMULATOR,this is working well till displaying two MARKERS on MAP where I have clicked but this is not not showing any route between these two MARKERS and then getting crashed.
Can you please help me out.
Thanks.
I did what you say in this tutorial, but got some problem about “import com.google.android.gms.maps.”
Could you help me, please!
Hello,
Thanks for this great tutorial, however, just as other people said, there is no any route between the two markers (origin and destination).I used Log.i to debug, found result.size()=0 at class ParserTask. Maybe there is something wrong when parsing JSON format.
Looking forward to your reply.
Sorry, this tutorial has no fault because I tested the web version, there is no route either.
Hello,
Please check you are getting a valid json data containing direction details from the function downloadUrl().
please help me in obtaining the route travelled on maps,using gps becoz i am doing an app on tracking gps enabled vehicles from diffrent locations.. pls do help..it is urgent
you are an excellent programmer.. thank you very much..
I use part of you code and work fine! Really thanks!!
Dear george
Thank you for your tutorial is very interesting
when I execute your project I have these two errors:
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
Thank you for your help
Best regards
hi you,
Thanks u so much for your code
Take a look at the Google Maps Android API utility library[1]
There is also a (better) Poly decoding and encoding tool
[1] … http://googlemaps.github.io/android-maps-utils/
Hi, george can you help me?
why did i get force close when i try to get direction
i use samsung galaxy Y duos to run the project
And Thanks, your tutorials are very good
Hi, i want to knw if it is possible to get google auto complete api key with out registering website address…. if yes then it would be great if you could explain that in detail.. thanks in advance
hi sir nice tutorial but , i need some code in which user can input both places name and then can find route , not by touch . i want to get input places from user through edit txt
Very nice tutorial. i need some code in which user can input destination place name and then can find route , not by touch . i want to get input place from user through edit txt
very nice tutorial , its working perfectly.. Thanks a lot..
nice
hello sir,
When I use the apk file in Samsung 2.3.6 version.I got force to close message in my android phone. please help me to solve this problm.
hey
update maps app in your phone as well play services it will fix the issue
Hi,may I know how can I get turn by turn direction using text view? For example turn left at 50 m, turn right at 100 m to get to the destination? Appreciate if anyone can help me
Thank you.
this is shortest path? it is Djikstra or greedy method?
Hi I tried this tutorial but the app is getting closed in android device. Please help me to resolve this.
Nice tutorial.
Please guide me
a) how can i get the latitude and longitude from the current location far 100 meters to find out the curve of road or turn found and find the angles.
thanks in advance
sir i tried google android api to draw directions between two points. its going well. i want to know how the show the direction in text form i.e like this “take right 100m, take left t0 200m”. please help me out. if possible send the code for doing this.
reply ASAP.
Thanks for the nice tutorial
How can I move my current pointer on the direction route, So that i can have navigation.
Thanks in Advance.
Dear Admin,
What do I need to change in the code if I want to draw line from a current location(setMyLocationEnable) to a marker by just click on the marker?
Thanks in advance for your reply!
why did i got error in this statement ” SupportMapFragment fm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);” My error is “map is not a field”
Thx for the tuts.
I’m getting a NullPointerException, because the value of result size is 0. I verify the log and the json output is got correctally. Which can be my problem? (The problem isn’t on the Parser). Thanks in advance.
hey Nice Tutorial but i want to change route to drag marker when i change route that PolyLine will not remove from google map any idea thannk
Hy there , is there an posibility to get all intersections from a route?
Dear friends,
I want to change the polyline color in some meter,
Pls any one do the need full.
Thanks
Hello. Nice tutorial. Can you please tell how can we display the traffic information on the routes ?
pls draw the class diagram how it works
Thanks for the tutorial, I need one more help that how can I make Geofencing to track that I am following correct route and I will get a alert If I am on wrong route.
very very nice tutorial , its working perfectly. Thanks a lot……
Hi sir your example so good but i got error of inflating fragment in logcat pls help i stuck here
hi,
if i select destination that is too far from the start location the map is not zooming out to include both markers.How will we do that.Can you tell me please
Hi,
Thanks for the tutorial.
I have a code to markers to a set of locations on google map v2.
And I need to add a feature where driving route will be shown when u click on any one marker from source marker.
Could you please add a tutorial for that?
i want a idea for make a app for public transportation. Is for 30 bus. each bus have one route. i want to know how i can if the user want go to some direction what bus or buses he has to take for go to that direction.
Thank you sir for you tutorial
This is very good example for Google Maps Direction APIs use
Thank you
Thank you sir for you tutorial
How list all route from my location to destination in Google Maps Android
hi sir, great tutorial by the way. i followed all the codes and no errors at all but when i run it then try to tap in the map i got the first position then when i tap again my app crashes . in what part did i got wrong ? please help. i run it with my device Gingerbread OS. thanks
hello sir!
really helpfull tutorial..
Now, I am doing the same but taking user input as entering location.
for that i am using place api.. which returns lat and longitude of both to and from and the i pass it within this..
i am merging ol.. yess.. i am getting the result but kinda conflict is there can u link me any example of doing the same.
I want to highlight different alternatives between two places.
This program just highlights one route.
thanks works perfect
1)i want shortest path like if i search medicals the medicals near me appear in the form of marker (i already done this) after that the shortest path is selected and show the distance and polyline
2) i want all medical stores show in a list and order by shortest distance
plz help
Hi George
thanks for this code.
But plz guide me How to get shortest route from my location to more then one location.
Hi George,
Thank you for this helpful code But plz tell me how to add third marker in this code plz help me.
thnks
thank you for this, it a great bit of code.
i want to know if there is a way to add traffic information to the app gotten from a user. like if i state there is traffic on this route then the next user on the same route will be given a different direction.
any information will be helpful.
thank you very much for this, it a great bit of code.
i want to know if there is a way to add traffic information to the app gotten from a user. like if i state there is traffic on this route then the next user on the same route will be given a different direction.
any information will be helpful.
helo… i follow ur tutrial … but map could not load … please help me … i got white screen zoom in and our button there but map is not loading…. give some tip
Thank you so much! It is very helpful
Thank u so much! Got success at first attempt.. .
thank youuuu, it’s very useful
Hi sir,
Your codes are working but i have to pass the origin and destination latlong value manually without touching the map i have to show the path when the activity starts.
thanks nice and very helpful post for me
Thank you so much ! it works perfectly
Hi George I want to do real-time tracking Gps Please can you help me thank you very much .
great tutorial from a great developer,
in my case, i need to develop an app that can help blinds to go from place A to place B using voice instructions. how can i do this using your tutorial
thanks in advance.
Thank you GEORGE MATHEW for Tutorial
very help me
Sir I want to add markers not on touch but on given longitude and latitude
Also this algo is taking too much time to calculate path
Hi,
Thanks for the code. But this code by default draw the route according to the “right lane”.But i live in a country where the drive lane is left. Please suggest the code changes for this .
Thanks
Hi, is it possible to get alternative route ..as it is possible in javascript google map api v3….? pls reply
thanks this is a great tutorial.
I want to put first marker as my current source location that is first appeared on map in blue dot.
means 1st marker will be automatically appear on current location which is in blue dot.
how can i do that in this code?
Does it give the shortest distance between the two points?
Is it possible to find the optimum distance between 3 points through GoogleMaps API-for delivery purposes….
I look forward to hear from you.
can i use this in android studio?
Sir your code for google place api for android map is very useful. can i use this code with google place api autocomplete code for showing the line between two marker.how is it possible???plz reply
Hi, I want to find a location which is in between two locations.how can you achieve this….Plz let me know…
Hello, I dont seem to get this part:
in.wptrafficanalyzer.locationroutedirectionmapv2.permission.MAPS_RECEIVE
why is it needed in the permission, should I also use it?
hope to hear from you.
Hello.
This code helped me a lot, guy!
Thanks!!
Is it possible to save the JSONObject to be parsed on a server and then retrieve it later to draw the route at a later time?
Hello sir! thank you so much for your tutorial it’s very helpful to my thesis about vehicle tracking system. Anyways, i would like to ask if this path being created is the shortest path? or kindly pls explain the algorithm you used. Thank you again sir
this example draws on path between two points. What if we want to draw all possible paths between two points.How can that be done?
Hey,
Thanks.. very nice example.. working great.
Thank you for this.
one note though:
In the MainActivity line 252
map.addPolyline(lineOptions);
This line should be inside the loop.
Again many thanks for this

Getting problem in getMap() showing this method deprecated.Please help
i want to take source as my current location and ask detination to user.the route between these two place shold be shown and travell time and distance also sholud be shown..what can i do ?
Can you please tell me what I should do to draw multiple routes between multiple locations? Its pretty urgent.
Should I make changes regarding url and downloadtask statements in onCreate function to mark multiple routes?