Places SDK for Android(新版)提供更出色的性能和新的定价模式,因此值得更新使用旧版 Places SDK for Android 的应用。如需详细了解如何比较功能,请参阅选择您的 SDK。
通过本指南,您可以了解 Places SDK for Android(新版)与 Places SDK for Android(旧版)之间的主要区别,以及如何处理必要的更改。
迁移的结算最佳实践
warning_amber
如果您的 API 用量足够高,达到了第二层级的价格,则适用此指南。迁移到较新版本的 API 时,您还需要按其他 SKU 付费。为避免在过渡月份增加费用,我们建议您尽可能在月初切换到生产环境中的新 API。这样可以确保您在迁移月份达到最具成本效益的每月价格层级。如需了解价格层级,请参阅价格页面和价格常见问题解答。
启用 Places SDK for Android(新)
Places SDK for Android(旧版)依赖于 Places API 服务。如需使用 Places SDK for Android(新版)的功能,您必须先在 Google Cloud 项目中启用 Places API(新版)。如需了解详情,请参阅设置您的 Google Cloud 项目。
然后,您必须确保已将 Places API(新)添加到应用使用的 API 密钥。如需了解详情,请参阅使用 API 密钥。
[null,null,["最后更新时间 (UTC):2025-03-21。"],[[["The Places SDK for Android (New) offers enhanced performance and a revised pricing structure, encouraging app updates."],["To minimize potential cost increases, it's advisable to transition to the new APIs at the start of a billing cycle."],["Before using the new SDK, enable the \"Places API (New)\" in your Google Cloud project and include it in your API key."],["Places SDK for Android (New) introduces mandatory field masking for Place Details, Nearby Search, and Text Search, defining specific data returned in responses."],["New features like Text Search (New) and Nearby Search (New) are additions to the SDK and do not require migration from existing functionalities."]]],["The Places SDK for Android (New) offers improved performance and a new pricing structure. To utilize it, enable the \"Places API (New)\" service in your Google Cloud project and add it to your app's API key. General changes include a new pricing model, required field masking for Place Details, Nearby Search, and Text Search, along with the addition of new classes. The `Place` object now has a `getReviews()` method. Switch to the new APIs as early as possible in the month to minimize billing costs.\n"]]