onDirectionSuccess is getting direction as REQUEST_DENIED
I tried to implement SimpleDirectionActivity and it is zooming to Origin as specified, but when I try to get directions it is getting direction to onDirectionSuccess as REQUEST_DENIED.
I also tried with different locations but no luck. Do you know why is this happening so ?? Thanks in advance.
Did you already enable Google Maps Direction API in Google Developer Console?
Yes I enabled it, I did some changes in your API call and I'm now able to get the results. Following are the changes
Direction Request:
Call<Direction> direction = DirectionAndPlaceConnection.createService().getDirection(param.getOrigin().latitude + "," + param.getOrigin().longitude, param.getDestination().latitude + "," + param.getDestination().longitude, param.getTransportMode(), param.getLanguage(), param.getAvoid(), param.getTransitMode(), true);
and in DirectionAndPlaceService :
@GET(DirectionUrl.DIRECTION_API_URL) Call<Direction> getDirection(@Query("origin") String origin, @Query("destination") String destination, @Query("mode") String transportMode, @Query("language") String language, @Query("avoid") String avoid, @Query("transit_mode") String transitMode, @Query("alternatives") boolean alternatives);
Now, I'm able to get the directions as required.