Reputation: 1747
I am trying to develop an android application. That i am using direction API
for draw a route
between two marker
. I am using the below code for drawing route
. When i am running application first time it is working fine. but at second time the direction api
shows OVER_QUERY_LIMIT
.
GoogleDirection.withServerKey("AIzaSyCua7p46J7YKwxS99H5orm2Ikn8OltIcF0")
.from(currentLatLng)
.to(desLatLng)
.transportMode(TransportMode.DRIVING)
.execute(this);
@Override
public void onDirectionSuccess(Direction direction, String rawBody) {
Toast.makeText(getApplicationContext(),"Success with status : " +direction.getStatus(),Toast.LENGTH_LONG).show();
if (direction.isOK()) {
Route route = direction.getRouteList().get(0);
int legCount = route.getLegList().size();
for (int index = 0; index < legCount; index++) {
Leg leg = route.getLegList().get(index);
//mMap.addMarker(new MarkerOptions().position(leg.getStartLocation().getCoordination()));
if (index == legCount - 1) {
// mMap.addMarker(new MarkerOptions().position(leg.getEndLocation().getCoordination()));
}
List<Step> stepList = leg.getStepList();
ArrayList<PolylineOptions> polylineOptionList = DirectionConverter.createTransitPolyline(this, stepList,
5, Color.BLACK, 3, Color.BLUE);
for (PolylineOptions polylineOption : polylineOptionList) {
mMap.addPolyline(polylineOption);
}
}
setCameraWithCoordinationBounds(route);
} else {
Toast.makeText(getApplicationContext(),direction.getStatus(),Toast.LENGTH_LONG).show();
}
}
@Override
public void onDirectionFailure(Throwable t) {
Toast.makeText(getApplicationContext(),t.getMessage(),Toast.LENGTH_LONG).show();
}
Upvotes: 1
Views: 147
Reputation: 7651
You may see the "OVER_QUERY_LIMIT" as a result of not having billing account , to use google direction api you will have to set billing account in your developer console.
Upvotes: 1