Skip to content
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

Route is not Drawn on Map #25

Open
Hamza-Rahman opened this issue Feb 11, 2019 · 9 comments
Open

Route is not Drawn on Map #25

Hamza-Rahman opened this issue Feb 11, 2019 · 9 comments

Comments

@Hamza-Rahman
Copy link

In My Map Two Point are ploted but path is not Shown Please Help Only Two point is visible

@guitorioadar
Copy link

Having same problem.

@devangichhatbar
Copy link

Same issue. Please help.

@iudragon
Copy link

iudragon commented Mar 16, 2019

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.

@andrianm28
Copy link

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

@imranhsn
Copy link

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.

@imranhsn
Copy link

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;
    }
}

@revego
Copy link

revego commented Apr 28, 2019

hello how do I implement Fetchurl() class? On my project I have insert the implementation dependency and DrawRouteMaps.getInstance() etc etc. Thanks

@samtamp95
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants