learntogrow-growtolearn
learntogrow-growtolearn

Reputation: 1280

Autocomplete Google maps API returns NULL

I am a newbie to android and google maps. Basically, I want to provide a search bar besided my mapview to users. The search bar should enable user to search for restaurants. I tried using the google autocomplete API . However, when I type one character to it, it returns null .

The code for my layout xml is :

<fragment
        android:id="@+id/place_autocomplete_fragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"    android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"/>

And I am simply loading this xml from my fragment class. Do I need to do anything in my fragment class to make this work?

Thanks a lot.

Upvotes: 0

Views: 1867

Answers (2)

Lolz
Lolz

Reputation: 71

error_message_screen_shot

I went to postman and paste the query to see what result do I get. Apparently, I didn't enable Billing in Google Cloud Platform.

Possible Solution:

  1. Try enabling Billing in your Google Cloud Platform by filling up your debit/credit card info to start free trial.
  2. Check if you enabled "Places API" in your Google Cloud Platform

Upvotes: 0

KENdi
KENdi

Reputation: 7741

There are many tutorials on the internet that can help you with your problem. From the Google documentation itself, they have a guideline on what autocomplete can do plus some sample code. The autocomplete service in the Google Places API for Android returns place predictions in response to user search queries. As the user types, the autocomplete service returns suggestions for places such as businesses, addresses and points of interest.

You can add autocomplete to your app in the following ways:

Just check the documentation above for more information.

For the different tutorials, you can follow either of these:

Upvotes: 0

Related Questions