Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>what @ohyes means is that you send multiple (too much) requests to google using your API key in too short of a time (for example, over 100 in a minute - just an example). </p> <p>for that you are receiving the <code>OVER_QUERY_LIMIT</code> and the empty JSON array</p> <p>while you should consider changing the time between the requests, you should also verify that the array received in fact has any elements</p> <pre><code>try { // Tranform the string into a json object final JSONObject json = new JSONObject(result); JSONArray routeArray = json.getJSONArray("routes"); if(routeArray.size() &gt; 0) { JSONObject routes = routeArray.getJSONObject(0); JSONObject overviewPolylines = routes.getJSONObject("overview_polyline"); encodedString = overviewPolylines.getString("points"); List&lt;LatLng&gt; list = decodePoly(encodedString); } } catch (JSONException e) { e.printStackTrace(); } </code></pre> <p>That would solve the exception being thrown, but it won't solve the fact that you are getting no result, probably because of the too much requests</p> <p><strong>EDIT:</strong></p> <p>The <code>OVER_QUERY_LIMIT</code> thing happens (probably) because of too fast calls to <code>getJSONFromUrl()</code> function. Please add the code that makes these calls so we could try and be more helpful on that.</p> <p>Probably 500 ms delay is not enough (I'm assuming you're doing this on a background thread and not <code>Sleeping</code> the UI thread as this is a bad habbit). try increasing the delay to something very high, such as a minute (60000 ms) and see if this helps. If it does, lower that number to the lowest one that works.</p> <p>And add the code please.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload