Reputation: 977
I am using this tutorial to create a autocomplete search box. I have created a custom adapter to populate my autocomplete text box.
mGoogleApiClient = new GoogleApiClient.Builder(ActivityMap.this)
.addApi(Places.GEO_DATA_API)
.enableAutoManage(this, GOOGLE_API_CLIENT_ID, this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
PendingResult<AutocompletePredictionBuffer> results =
Places.GeoDataApi.getAutocompletePredictions(mGoogleApiClient,
constraint.toString(),
mBounds, null);
However, I am receiving the following error message as follows:
{statusCode=ERROR_OPERATION_FAILED, resolution=null}
for the following lines of code in the getPredictions method in the Adapter
final Status status = autocompletePredictions.getStatus();
if (!status.isSuccess()) {
Toast.makeText(getContext(), "Error: " + status.toString(),
Toast.LENGTH_SHORT).show();
Log.e(TAG, "Error getting place predictions: " + status.toString());
autocompletePredictions.release();
return null;
}
PS: In the lines:
PendingResult<AutocompletePredictionBuffer> results =
Places.GeoDataApi
.getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
mBounds, mPlaceFilter);
I have tried changing mPlaceFilter to null, to the same result
Upvotes: 0
Views: 1652
Reputation: 977
Finally, figured it out. I was writing a different API key in the Android Manifest.
Also, if you are using the Google API Key for more than one application, specify the key once only (using the Android Tutorials setup guide) and enable support for other API's within the same project.
Upvotes: 3