Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Google Places Autocomplete per session from SDKs?

Is it possible to implement session based autocomplete from the places sdk for Android and iOS apps?

According to new Google Maps framework pricing coming into effect June 11th request made to autocomplete can be broken down into keystroke/session based.

New Pricing coming into effect June 11th

I haven't been able to find documentation describing implementation steps, except for this reference.

enter image description here

like image 552
Romina Liuzzi Avatar asked May 22 '18 13:05

Romina Liuzzi


People also ask

How do I use Google Places autocomplete API?

Go to the Google Cloud Console. Click the Select a project button, then select the same project you set up for the Maps JavaScript API and click Open. From the list of APIs on the Dashboard, look for Places API. If you see the API in the list, you're all set.

Is Google Maps autocomplete API free?

The autocomplete request is available at no charge, and the subsequent Place Details call gets charged based on regular Place Details pricing. A Place Details request generates Data SKUs (Basic, Contact, and/or Atmosphere) – depending on the fields that are specified in the request.

What is session token in Google places API?

Place Autocomplete uses session tokens to group the query and selection phases of a user autocomplete search into a discrete session for billing purposes. The session begins when the user starts typing a query, and concludes when they select a place and a call to Place Details is made.


1 Answers

The session tokens will be available in the new versions of Google Places SDK for Android and Google Places SDK for iOS. These new versions are announced in the user guide documentation.

Google is currently preparing new versions of the Places SDK for Android, and the Places SDK for iOS. The following section describes the changes and explains how they will affect you.

  • A new Places SDK for Android will be made available as a standalone library, and will no longer be available through Google Play services; This version will not be backward-compatible with the current SDK
  • A new Places SDK for iOS will be made available

It's worth noting that several Places SDK features will be updated to reflect overall Places API changes, affecting both mobile platforms:

  • Place Details (Android, iOS) request will have a new fields parameter.
  • Autocomplete billing will be session-based.

In the coming months we will share more details including a timeline and appropriate lead time to migrate to the new SDK versions. These new versions will replace the current SDK versions. The current SDKs will be deprecated and will follow appropriate deprecation timelines.

source: https://cloud.google.com/maps-platform/user-guide/product-changes/

In the current version of Places SDK there are no session tokens. Unfortunately, there is no exact ETA for new versions of SDKs. Hopefully, they will be available in couple of months. Stay tuned to Google announcements.

Regarding billing of current versions of Places SDK for Android and Places SDK for iOS I'm not sure. Probably they will be free of charge as deprecated versions. I would suggest reach out to Google support with this question.

You can also check this question regarding sessions:

How long do the new Places API session tokens last?

I hope this clarifies your doubt.

Update

The new version of the Places Android SDK is now available. You can read about the new version at

https://developers.google.com/places/android-sdk/client-migration

Note that the previous SDK is deprecated and will be shut down on July 29, 2019.

The new version of SDK implements session tokens for autocomplete.

The new version of the Places SDK for Android is distributed as a static client library. Until now, the Places SDK for Android has been made available through Google Play Services.

A compatibility library is available, which enables you to switch from the deprecated Google Play Services Places library to the new static library with minimal effort.

There are all-new methods.

Field masks are now supported for methods that return place details. You can use field masks to specify which types of place data to return.

The exceptions used to report errors have been improved.

Autocomplete now supports session tokens.

like image 66
xomena Avatar answered Oct 10 '22 02:10

xomena