The Places SDK for Android (New) provides improved performance and a new pricing model, making it worthwhile to update apps that use the Places SDK for Android (Legacy). For more details on comparing features, see Choose your SDK .
Это руководство поможет вам понять ключевые различия между Places SDK для Android (новая версия) и Places SDK для Android (старая версия), а также как вносить необходимые изменения.
Billing best practices for migration
This guidance applies if your API usage is high enough to move into second-tier pricing. When migrating to a newer version of an API, you're also being billed for a different SKU. To avoid increased costs during the month of your transition, we recommend switching to the new APIs in production as close to the beginning of the month as possible. This will ensure that you reach the most cost-effective monthly pricing tiers during the migration month. For information about pricing tiers, see the pricing page and the pricing FAQ .
Enable Places API (New)
Places SDK for Android (Legacy) relies on the Places API service. To use the features of Places SDK for Android (New), you must first enable Places API (New) in your Google Cloud project. For more information, see Set up your Google Cloud project .
You then must ensure that you have added Places API (New) to the list of authorized APIs on the key used by your app. For more information, see Use API Keys .
Убедитесь, что у вас достаточно квоты в Places API (новая функция).
Make sure that there is enough quota in the Places API (New) to cover your current traffic. To review and manage your quotas and usage limits, see Quotas and quota alerts .
Note the difference:
- Квота для Places SDK для Android (Legacy) зависит от квоты сервиса Places API. Она представляет собой сумму всех методов Places API.
- Квота для Places SDK для Android (новая версия) зависит от квоты сервиса Places API (новая версия). Для каждого метода API существует отдельная квота.
Проверьте, включает ли ваше согласованное соглашение API Places (новый сервис).
If you have a negotiated agreement, check that it covers the Places API (New), with the expected pricing. If not, contact your Sales contact person at Google or your partner to discuss how you can include this API.
Общие изменения
К числу общих изменений, применимых к нескольким API, относятся следующие:
Используется новая модель ценообразования. Информацию о ценах на все API см. в разделе Places SDK для Android (новая версия) .
You must initialize your app by calling the
Places.initializeWithNewPlacesApiEnabled()method. For more information on selecting the Places API service, see Set up your Google Cloud project .Place Details (New) , Nearby Search (New) , and Text Search (New) require field masks to specify which fields you want returned in the response.
Добавлены новые классы для определения запросов или добавления новых полей в ответ.
The response
Placeobject contains the newgetReviews()method that returns a List ofReviewobjects. When your app displays information obtained from thePlaceobject, such as photos and reviews, the app must also display the required attributions.Для получения более подробной информации см. документацию по атрибуции .
изменения, специфичные для API
В этом разделе представлены следующие руководства по миграции для каждого API:
- Переход от раздела «Подробная информация о месте» (устаревшая версия) к разделу «Подробная информация о месте» (новая версия)
- Перенос данных с Place Photo (устаревшая версия) на Place Photo (новая версия)
- Переход с автозаполнения (устаревшая версия) на автозаполнение (новая версия)
- Перенести данные из раздела «Текущее местоположение» (устаревшая версия) в раздел «Поиск поблизости» (новая версия)