0

I'm using google Maps in a fragment and on top of it I'm using PlaceAutoComplete fragment. The problem I'm facing is that when I click on the PlaceAutoComplete widget it shows me a error.

Code:

placeAutoComplete.setOnPlaceSelectedListener(new PlaceSelectionListener() {
        @Override
        public void onPlaceSelected(Place place) {
            Log.d("Maps", "Place selected: " + place.getName());
            addMarker(place); 
        }

        @Override
        public void onError(Status status) {
            Toast.makeText(getContext(),"Erro",Toast.LENGTH_SHORT).show();
            Log.d("Maps", "An error occurred: " + status);
        }
    });

Error:

Status{statusCode=ERROR, resolution=null}

New Error:

   {"errors":[{"domain":"global","reason":"forbidden","message":"Requests
to this API placesandroid method places.
PlacesService.AutocompleteWidget are blocked."}],"code":403}P
  • Possible duplicate of [Google Place Api: Requests from this Android client application com.package.name are blocked](https://stackoverflow.com/questions/50712425/google-place-api-requests-from-this-android-client-application-com-package-name) – Suleyman Jun 29 '18 at 16:25

1 Answers1

0

Enable the Places API in Google Developers Console (https://console.developers.google.com/).

Raj
  • 2,997
  • 2
  • 12
  • 30