I am trying to get directions in an app, but I keep getting a REQUEST_DENIED
, I am using the library mentioned in this answer (And here is the repo)
I have the API key and I am using it like this:
GoogleDirection.withServerKey(getString(R.strings.google_maps_key))
.from(new LatLng(40.2085, -3.7136))
.to(new LatLng(mCoord[0], mCoord[1]))
.avoid(AvoidType.FERRIES)
.avoid(AvoidType.HIGHWAYS)
.execute(new DirectionCallback() {
@Override
public void onDirectionSuccess(Direction direction) {
if (direction.isOK()) {
Toast.makeText(getApplicationContext(), "DIRECTION KOK", Toast.LENGTH_LONG).show();
// direction.
} else {
Toast.makeText(getApplicationContext(), direction.getStatus(), Toast.LENGTH_LONG).show();
}
}
@Override
public void onDirectionFailure(Throwable t) {
Toast.makeText(getApplicationContext(), "Failure", Toast.LENGTH_LONG).show();
}
});
I don't have any clue of what is failing.