3

According to This Official Post

I'm following below steps to integrate Place Picker UI dialog with Map.

launcher code

    PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
    startActivityForResult(builder.build(this), PLACE_PICKER_REQUEST);

inside onActivityResult()

    if (requestCode == PLACE_PICKER_REQUEST) {
        if (resultCode == RESULT_OK) {
            Place place = PlacePicker.getPlace(this, data);
            tvChooseLocation.setText(place.getName());
        }
    }

I have added all permissions & API_KEY in Manifest file

Problem is I am not able to select location from Place Picker dialog.

Select button is disabled

Select button is disabled by default.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Aks4125
  • 4,522
  • 4
  • 32
  • 48

2 Answers2

2

I have solved this so I don't quite know which one of these steps solves it

In console.developer.google.com

I enable Places API and Maps API, and download the json from here.

Also, get the API key from Credential page.

In Android Studio

In manifest, add in between <application> ... </application>

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

In onCreate(), add this (though I don't quite sure this is needed or not)

private GoogleApiClient mGoogleApiClient;
mGoogleApiClient = new GoogleApiClient
.Builder(this)
.addApi(Places.GEO_DATA_API)
.addApi(Places.PLACE_DETECTION_API)
.enableAutoManage(this, this)
.build();

Everything else just follow the tutorial in here. Also, I tested it in release version. If you still have the same problem, try make a release one. I failed to get the location in emulator but it work just fine in my phone.

Hopefully this can help anyone in the future.

August
  • 309
  • 1
  • 5
  • 15
1

Try enabling google places api from google developer console

Link to console

--Wanted to comment though but do not have permission.

Nikhil
  • 1,021
  • 12
  • 13