0

We are not able to see Google Places API for Android in the Google API services list. we are switching an app to a new google account, so we are enabling all the existing services in the new account where are not able to find the Google Places API for Android.
We need to enable Google Places API for Android into the new account to support the existing customers until we do the migration.
Can you please help us on this?

Kartheek
  • 7,104
  • 3
  • 30
  • 44
  • [This answer](https://stackoverflow.com/a/56051312/4815718) from a Google support person seems to indicate that only projects that previously used the Places API have access to it and new projects will not: _Please note that the old users that used Places SDK for iOS/Android are the only one who can still use the Place Picker during the deprecation period_. – Bob Snyder May 12 '19 at 15:35

1 Answers1

1

According to Google new policy "Deprecation notice: Google Play Services version of the Places SDK for Android"

Notice: The Google Play Services version of the Places SDK for Android (in Google Play Services 16.0.0) is deprecated as of January 29, 2019, and will be turned off on July 29, 2019. A new version of the Places SDK for Android is now available. We recommend updating to the new version as soon as possible. For details, see the migration guide. Google Place Autocomplete

Add the Gradle Dependancy

implementation 'com.google.android.libraries.places:places:1.0.0'

Initialize the Place API

Places.initialize(getApplicationContext(), "YOUR_API_KEY");

Start the Autocomplete Intent

List<Place.Field> fields = Arrays.asList(Place.Field.ID, Place.Field.NAME);
    Intent intent = new Autocomplete.IntentBuilder(
            AutocompleteActivityMode.OVERLAY, fields)
            .build(this);
    startActivityForResult(intent, 1101);

onActivityResult

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == request_code) {
        if (resultCode == RESULT_OK) {
            Place place = Autocomplete.getPlaceFromIntent(data);
            Log.i(TAG, "ManishPlace: " + place.getName() + ", " + place.getId());
            txt_search.setText(place.getName());
        } else if (resultCode == AutocompleteActivity.RESULT_ERROR) {
            // TODO: Handle the error.
            Status status = Autocomplete.getStatusFromIntent(data);
            Log.i(TAG, status.getStatusMessage());
        } else if (resultCode == RESULT_CANCELED) {
            // The user canceled the operation.
        }
    }
}

Or Follow the my GitHub Tutorial

Google Place Search GitHub Repository

Manish Ahire
  • 550
  • 4
  • 19
  • Currently we are migrating to the new Places API, but meanwhile, we need to support the existing customers. – Kartheek May 07 '19 at 09:32