new places api is not working : com.google.android.gms.common.api.ApiException: 9011: Requests from this Android client application are blocked.
i have new places api enebaled . then tried to also enable old one but still not working . billing account is active . restricted key with both api . i used sha1 Release certificate fingerprint .not working
then released pp on google play console for open testing and added signing sha1 from play console to cloude key but still not working with non of sha1 .
i have one project with 2 app on firebase . but i use only place api in app1 and not app2 . app 1 is released on play console and app 2 no .
i updated json in both app .
i also tried to to use id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
String apikey = BuildConfig.PLACES_API_KEY;
but still not working .
String apikey = BuildConfig.PLACES_API_KEY;
if (!Places.isInitialized()) {
Places.initializeWithNewPlacesApiEnabled(
getApplicationContext(),
apikey
);
}
placesClient = Places.createClient(this);
private void SearchPlaces(){
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
if (!TextUtils.isEmpty(query.trim())){
searchPlc(query);
}
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (!TextUtils.isEmpty(newText.trim())){
searchPlc(newText);
}
return false;
}
});
}
private void searchPlc(final String query) {
FindAutocompletePredictionsRequest request =
FindAutocompletePredictionsRequest.builder()
.setQuery(query)
.setTypesFilter(Arrays.asList("city", "address"))
.setCountries("IT")
.build();
placesClient.findAutocompletePredictions(request)
.addOnSuccessListener(response -> {
predictionsList.clear();
for (AutocompletePrediction prediction : response.getAutocompletePredictions()) {
String text = prediction.getFullText(null).toString();
Log.d("Places", "Prediction: " + text);
predictionsList.add(text);
}
adapter.notifyDataSetChanged();
})
.addOnFailureListener(e -> Log.e(TAG, "Autocomplete error: ", e));
}
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.9.25")) implementation 'com.google.android.libraries.places:places:5.0.0'