DrawRouteMaps
DrawRouteMaps copied to clipboard
Route is not Drawn on Map
In My Map Two Point are ploted but path is not Shown Please Help Only Two point is visible
Having same problem.
Same issue. Please help.
SOLUTION: Now you need to edit dependency to "implementation 'com.github.code2080:DrawRouteMaps:1.1.0'" and using DrawRoutMaps like this DrawRouteMaps.getInstance(getActivity(), "your_googlemap_api_key")
MAKE SURE YOU ENABLE DIRECTIONS API too.
SOLUTION: Now you need to edit dependency to "implementation 'com.github.code2080:DrawRouteMaps:1.1.0'" and using DrawRoutMaps like this DrawRouteMaps.getInstance(getActivity(), "your_googlemap_api_key")
MAKE SURE YOU ENABLE DIRECTIONS API too.
still the route is not drawn on map
Solution: You have to add API key in the FetchUrl class and your URL should be like this:
String url = "https://maps.googleapis.com/maps/api/directions/"+output+"?"+parameters + "&key=" + MY_API_KEY
Hope you'll find your solution.
Update FetchUrl class:
public class FetchUrl {
public static String getUrl(LatLng origin, LatLng dest) {
String str_origin = "origin=" + origin.latitude + "," + origin.longitude;
String str_dest = "destination=" + dest.latitude + "," + dest.longitude;
String sensor = "sensor=false";
String MY_API_KEY = "";
String parameters = str_origin + "&" + str_dest + "&" + sensor;
String output = "json";
return "https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters + "&key=" + MY_API_KEY;
}
}
hello how do I implement Fetchurl() class? On my project I have insert the implementation dependency and DrawRouteMaps.getInstance() etc etc. Thanks
Hi, you can solve this problem through this method:
make sure your implementation is:
implementation 'com.github.code2080:DrawRouteMaps:1.1.0'
then change the draw route to:
DrawRouteMaps.getInstance(getActivity(), "your_googlemap_api_key").draw(pos1, pos2, mMap);
Keynotes: please ensure that the API you have is enabled on google developer page you can check this on your logcat while running. Since you would need direction API to be enables and also have billing enabled.
SOLUTION: Now you need to edit dependency to "implementation 'com.github.code2080:DrawRouteMaps:1.1.0'" and using DrawRoutMaps like this DrawRouteMaps.getInstance(getActivity(), "your_googlemap_api_key")
MAKE SURE YOU ENABLE DIRECTIONS API too.
You save my Life. this corection in code: DrawRouteMaps.getInstance(ctx,api_key).draw(origin, destination, mMap);