2

I am trying to implement places autocomplete widget in my app, but when I open the widget it instantly closes and outputs in the logcat:

E/Places: Autocomplete widget closing due to PLACES_API_ACCESS_NOT_CONFIGURED

It correctly identifies the key in the AndroidManifest.xml. The API key is unrestricted, so that can't be the problem.

My code:

place.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                try {
                    Intent intent =
                            new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY)
                                    .build(getActivity());
                    startActivityForResult(intent, 1);
                } catch (GooglePlayServicesRepairableException e) {
                    Toast.makeText(getActivity(), "GooglePlayServicesRepairableException",
                            Toast.LENGTH_LONG).show();
                } catch (GooglePlayServicesNotAvailableException e) {
                    Toast.makeText(getActivity(), "GooglePlayServicesNotAvailableException",
                            Toast.LENGTH_LONG).show();
                }
            }
        });
Tamas Koos
  • 1,053
  • 3
  • 15
  • 35

2 Answers2

0

So if anyone is facing the same issue, I solved it by going to the API Dashboard and enabling Places SDK for Android. Only enabling the Places API is not enough and the error messages and instructions weren't clear to me.

Tamas Koos
  • 1,053
  • 3
  • 15
  • 35
  • Can you please clarify how to enable Place SDK for Android? When enabling APIs and querying for "Place SDK for Android", Google returns only "Places API", which keeps giving me the PLACES_API_ACCESS_NOT_CONFIGURED 9003 error. Thanks – nibbana Feb 05 '19 at 18:25
  • If you have enabled the Places API, then you have to select the project in the dropdown on the top of the page. Inside the project, open the APIs menu and there you can see all available APIs. – Tamas Koos Feb 05 '19 at 19:08
  • Turns out that at the time of writing it is not possible to enable Place SDK for Android, as Google is migrating to the "New Places SDK Client" (developers.google.com/places/android-sdk/client-migration). Some links are even broken, and Google released only yesterday Feb 4, 2019 a script for converting automatically the code (developers.google.com/places/android-sdk/…). What a mess. – nibbana Feb 05 '19 at 20:02
-5

Thanks. Add following to the AndroidManifest.xml

<meta-data
android:name="com.google.android.places.API_KEY"
android:value=<your api key>/>
Sirish
  • 11
  • 1