У меня проблемы с API Google Адресов Google - функция автозаполнения. Я использую тот же ключ, что и для Android API Google Maps (и в документации написано, что все в порядке). Вот мое определение в манифесте:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="mykey"/>
Но getAutocompletePredictions возвращает сообщение 'PLACES_API_ACCESS_NOT_CONFIGURED' как статус.
Вот мой код Java:
GoogleApiClient googleApiClient = new GoogleApiClient.Builder(context)
.addApi(Places.GEO_DATA_API)
.addApi(Places.PLACE_DETECTION_API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
googleApiClient.connect();
LatLngBounds latLngBounds = new LatLngBounds.Builder().
include(SphericalUtil.computeOffset(latlon, RADIUS, 0)).
include(SphericalUtil.computeOffset(latlon, RADIUS, 90)).
include(SphericalUtil.computeOffset(latlon, RADIUS, 180)).
include(SphericalUtil.computeOffset(latlon, RADIUS, 270)).build();
PendingResult<AutocompletePredictionBuffer> result = Places.GeoDataApi.getAutocompletePredictions(googleApiClient, constraint.toString(), latLngBounds, null);
AutocompletePredictionBuffer autocompletePredictions = result.await(Config.DATA_TIMEOUT, TimeUnit.MILLISECONDS);
Status status = autocompletePredictions.getStatus();
if (status.isSuccess()) {
Iterator<AutocompletePrediction> iterator = autocompletePredictions.iterator();
while (iterator.hasNext()) {
AutocompletePrediction prediction = iterator.next();
//... do stuff here ...
}
}
else {
Log.d(TAG, status.getStatusMessage());
}
autocompletePredictions.release();
googleApiClient.disconnect();
Заранее спасибо