getAutocompletePredictions is not working

Asked

Viewed 27 times

0

Hello, I’m having problems with Getautocompletepredictions from google Api, I’m not able to know if I can fix the function or I have to update the api and redo it.

2021-01-07 07:39:48.368 5586-7207/com.google.android.gms W/GoogleURLConnFactory: Blocked by temporary_blocked2: https://www.googleapis.com/placesandroid/v1/getAutocompletePredictions?key=AIzaSyDvXZW_zbo6aNK8WL5lUkbp8oSEUTMQytw
2021-01-07 07:39:48.373 5586-11505/com.google.android.gms E/AsyncOperation: serviceID=65, operation=GetAutoPredictions
OperationException[Status{statusCode=NETWORK_ERROR, resolution=null}]
at bihn.a(:com.google.android.gms@201817022@20.18.17 (040700-311416286):2)
at bihb.a(:com.google.android.gms@201817022@20.18.17 (040700-311416286):35)
at zus.run(:com.google.android.gms@201817022@20.18.17 (040700-311416286):10)
at blot.run(:com.google.android.gms@201817022@20.18.17 (040700-311416286):2)
at sji.b(:com.google.android.gms@201817022@20.18.17 (040700-311416286):12)
at sji.run(:com.google.android.gms@201817022@20.18.17 (040700-311416286):7)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at spj.run(:com.google.android.gms@201817022@20.18.17 (040700-311416286):0)
at java.lang.Thread.run(Thread.java:923)
2021-01-07 07:39:48.376 5586-9345/com.google.android.gms I/Places: ?: Couldn't find platform key file.
2021-01-07 07:39:48.383 11316-11542/com.performait.woorkandroid E/PlaceAutoCompleteAdapter: [Woork] - [com.performait.woorkandroid.controller.adapter.PlaceAutoCompleteAdapter] - [getAutocomplete] - Error getting autocomplete prediction API call: Status{statusCode=NETWORK_ERROR, resolution=null}
2021-01-07 07:39:48.585 5664-6559/com.google.android.inputmethod.latin W/native: neural_spatial_model.cc:390 Output symbol table doesn't contain symbol: @

Here comes the code!

private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) {
    ArrayList<AutocompletePrediction> result = null;

    if (mGoogleApiClient.isConnected()) {
        Logger.d(TAG, this.getClass().getName(), "getAutocomplete", "Starting autocomplete query for: " + constraint);
        PendingResult<AutocompletePredictionBuffer> results = Places.GeoDataApi.getAutocompletePredictions(mGoogleApiClient, constraint.toString(), mBounds, mPlaceFilter);
        AutocompletePredictionBuffer autocompletePredictions = results.await(60, TimeUnit.SECONDS);

        final Status status = autocompletePredictions.getStatus();
        if (status.isSuccess()) {
            Logger.d(TAG, this.getClass().getName(), "getAutocomplete", "Query completed. Received " + autocompletePredictions.getCount() + " predictions.");
            result = DataBufferUtils.freezeAndClose(autocompletePredictions);
        }
        else{
            UiUtil.notifyCommunicationError((Activity) getContext(), new CommunicationException(CommunicationException.ErrorType.SERVER_RESPONSE_ERROR, getContext().getString(R.string.home_explore_error_address_not_found)));
            Logger.e(TAG, this.getClass().getName(), "getAutocomplete", "Error getting autocomplete prediction API call: " + status.toString(), null);
            autocompletePredictions.release();
        }
    }
    else{
        Logger.e(TAG, this.getClass().getName(), "getAutocomplete", "Google API client is not connected for autocomplete query.", null);
    }


    return result;
}

That one final Status status = autocompletePredictions.getStatus(); is returning me null.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.