how to rectify the error in google places api in android

519 Views Asked by At

Hi I am using google maps with searchbox to show places in AutoCompleteTextView like google maps. I am using a single api key by enabling google maps android api,google maps places api google maps webservice api. I want maps and autocomplete to work in release mode. I am getting error like this:

Unable to fetch autocomplete results from the api com.seatgeek.placesautocomplete.model.PlacesApiException: This IP, site or mobile application is not authorized to use this API key. Request received from IP address 2405:205:810a:751f:6c8e:2381:c79a:eee4, with empty referer.

My manifest code is

<meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

My autocompletetextview

<com.seatgeek.placesautocomplete.PlacesAutocompleteTextView
              android:id="@+id/places_autocomplete"
              android:hint="drop address"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:background="@android:color/white"
              android:drawableEnd="@drawable/ic_cancel_black_24dp"
              android:drawableLeft="@drawable/ic_add_location_black_48dp"
              android:drawableRight="@drawable/ic_cancel_black_24dp"
              android:drawableStart="@drawable/ic_add_location_black_48dp"
              android:elevation="10dp"
              android:isScrollContainer="true"
              android:ellipsize="end"
              android:marqueeRepeatLimit="marquee_forever"
              android:singleLine="true"
              app:pacv_historyFile="@string/pacv_default_history_file_name
              app:pacv_googleMapsApiKey="@string/google_maps_key"
              android:layout_below="@+id/ed_place_autocomplete"
              android:layout_alignEnd="@+id/imagebutton_searchView"
              android:layout_alignParentBottom="true" />

I generate key for debug and release with sha1 fingerprint and package name and stored it in strings\google_api_xml file under values. Please help me.

1

There are 1 best solutions below

0
On

Please check that your Manifest file contains all the required permissions and google play services version defined.

For google maps v2 you need android key and for google places api you need a server key.

Make sure you have enabled API.