Places SDK(旧版)概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助 Places SDK,您可以使用文本字符串或按邻近程度搜索和检索各种地点类型的信息。Places SDK 是 Places SDK(新)的旧版。
请使用本指南了解 Places SDK 各版本之间的主要区别,并迁移到 Places SDK(新)。
各版本中提供的 SDK 功能
下表显示了每项 SDK 功能所需的 SDK 和 API 版本:
迁移到新 API
如需迁移到新 API,请参阅以下迁移指南:
Places SDK for Android 中的增强功能(新)
本部分介绍了添加到 Places SDK for Android(新版)中的主要功能。
Places SDK for Android(新)是在 Google Cloud 上的服务基础架构上实现的。此实现可打造更安全、更值得信赖的平台。这种标准设计可在各个 SDK 之间实现一定程度的一致性,从而提高使用 Places SDK for Android(新版)进行开发的效率。
Places SDK for Android(新版)可提供更出色的性能,因此值得替换使用现有 SDK 的应用。
新功能
Places SDK for Android(新)包含所有 SDK 功能的最新版本:
新的文本搜索服务
文本搜索(新)可以根据一个字符串(例如,“北京烤鸭”“南京附近的鞋店”或“长安街 8 号”)返回一组地点的相关信息。该服务会返回一个与文本字符串和任何位置偏向设置相匹配的地点列表。
为“地点详情(新)”和“地点照片(新)”添加了新的响应数据
向 Place Photos(新)添加了新的 URI 响应
您现在可以使用 Place Photo(新)来返回图片位图的 URI。以前,您只能返回图片位图本身。
简化的价格方案
Places SDK for Android(新)简化了定价,因此您只需为所用的数据付费。简化的定价是使用字段列表(也称为字段掩码)实现的。
对于“地点详情”和“文本搜索”,您可以使用字段列表来控制要在响应中返回的字段列表。然后,您只需为所请求的数据付费。使用字段列表是一种有效的设计做法,可确保您不会请求不必要的数据,这有助于避免产生不必要的处理时间和结算费用。
如需详细了解这两个 SDK 的价格信息,请参阅用量和结算。
扩展的地点类型
新版 SDK 包含新的地点类型,这些类型会作为地点详情和文本搜索响应的一部分返回。您还可以在使用文本搜索的搜索中,使用这些新类型以及现有类型。新类型已包含在表 A 中。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-30。
[null,null,["最后更新时间 (UTC):2025-08-30。"],[],[],null,["The Places SDK lets you search for and retrieve information for a variety of\nplace types using a text string or by proximity. Places SDK is the legacy\nversion of Places SDK (New).\n\nUse this guide to understand the key differences between the Places SDK versions\nand migrate to Places SDK (New).\n\nSDK features available in each version\n\nThe following table shows which SDK and API versions are required for each SDK\nfeature:\n\n| Feature | Places API enabled on API key | Initialization method | Minimum SDK version |\n|---------------------------------------------------------------------------------|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|\n| [Autocomplete (New)](/maps/documentation/places/android-sdk/place-autocomplete) | Places API (New) | [`initializeWithNewPlacesApiEnabled()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initializeWithNewPlacesApiEnabled(android.content.Context,%20java.lang.String)) | 3.5.0 |\n| [Place Details (New)](/maps/documentation/places/android-sdk/details-place) | Places API (New) | [`initializeWithNewPlacesApiEnabled()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initializeWithNewPlacesApiEnabled(android.content.Context,%20java.lang.String)) | 3.3.0 |\n| [Nearby Search (New)](/maps/documentation/places/android-sdk/nearby-search) | Places API (New) | [`initializeWithNewPlacesApiEnabled()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initializeWithNewPlacesApiEnabled(android.content.Context,%20java.lang.String)) | 3.5.0 |\n| [Place Photos (New)](/maps/documentation/places/android-sdk/place-photos) | Places API (New) | [`initializeWithNewPlacesApiEnabled()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initializeWithNewPlacesApiEnabled(android.content.Context,%20java.lang.String)) | 3.4.0 |\n| [Text Search (New)](/maps/documentation/places/android-sdk/text-search) | Places API (New) | [`initializeWithNewPlacesApiEnabled()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initializeWithNewPlacesApiEnabled(android.content.Context,%20java.lang.String)) | 3.3.0 |\n| [Place Autocomplete](/maps/documentation/places/android-sdk/autocomplete) | Places API | [`initialize()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initialize(android.content.Context,%20java.lang.String)) | |\n| [Current Place](/maps/documentation/places/android-sdk/current-place) | Places API | [`initialize()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initialize(android.content.Context,%20java.lang.String)) | |\n| [Place Details](/maps/documentation/places/android-sdk/place-details) | Places API | [`initialize()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initialize(android.content.Context,%20java.lang.String)) | |\n| [Place Photos](/maps/documentation/places/android-sdk/photos) | Places API | [`initialize()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initialize(android.content.Context,%20java.lang.String)) | |\n\nMigrate to the new APIs\n\nTo migrate to the new APIs, see the following migration guides:\n\n- [Migrate to Place Details (New)](/maps/documentation/places/android-sdk/migrate-details)\n- [Migrate to Place Photo (New)](/maps/documentation/places/android-sdk/migrate-photo)\n- [Migrate to Autocomplete (New)](/maps/documentation/places/android-sdk/migrate-autocomplete)\n\nEnhancements in Places SDK for Android (New)\n\nThis section covers key features added to Places SDK for Android (New).\n\nImplemented on the Google Cloud standard platform\n\nPlaces SDK for Android (New) is implemented on the [service\ninfrastructure](https://cloud.google.com/service-infrastructure/docs/overview)\non Google Cloud. This implementation brings a more secure and trusted platform.\nThis standard design brings a level of consistency across the SDKs that improve\nthe efficiency of development with Places SDK for Android\n(New).\n\nImproved performance\n\nPlaces SDK for Android (New) provides improved performance, making it\nworthwhile to replace apps that use the existing SDK.\n\nNew features\n\nThe Places SDK for Android (New) includes the latest versions of all of the SDK\nfeatures:\n\n- [Autocomplete (New)](/maps/documentation/places/android-sdk/place-autocomplete)\n- [Place Details (New)](/maps/documentation/places/android-sdk/details-place)\n- [Nearby Search (New)](/maps/documentation/places/android-sdk/nearby-search)\n- [Place Photos (New)](/maps/documentation/places/android-sdk/place-photos)\n- [Text Search (New)](/maps/documentation/places/android-sdk/text-search)\n\nNew Text Search service\n\n[Text Search](/maps/documentation/places/android-sdk/legacy/text-search) (New) returns information\nabout a set of places based on a string --- for example \"pizza in New York\" or\n\"shoe stores near Ottawa\" or \"123 Main Street\". The service responds with a list\nof places matching the text string and any location bias that has been set.\n\nNew response data added to Placed Details (New) and Place Photos (New)\n\n- [Place Details](/maps/documentation/places/android-sdk/details-place)\n (New) now includes the new\n [Review](/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/Review)\n class in the response `Place` object. The\n [Place](/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/Place) class\n contains the new `getReviews()` method to support this field. Call\n `getReviews()` to return up to five reviews for a place.\n\n- [Place Photo](/maps/documentation/places/android-sdk/place-photos)\n (New) adds the\n [`AuthorAttributions`](/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/AuthorAttributions)\n to the `PhotoMetadata` class. `AuthorAttributions` contains a `List` of\n [`AuthorAttribution`](/maps/documentation/places/android-sdk/legacy/reference/com/google/android/libraries/places/api/model/AuthorAttribution)\n objects.\n\nNew URI response added to Place Photos (New)\n\nYou can now use\n[Place Photo](/maps/documentation/places/android-sdk/place-photos)\n(New) to return a URI to an image bitmap. Previously, you could only return the\nimage bitmap itself.\n\nSimplified pricing\n\nPricing is simplified with Places SDK for Android (New) so that you only\npay for the data you use. Simplified pricing is implemented using field lists,\nalso called *field masks*.\n\nWith Place Details and\nText Search you use field lists to control the list of\nfields to return in the response. You are then only billed for the data\nrequested. Using a field list is a good design practice to ensure that you don't\nrequest unnecessary data, which helps to avoid unnecessary processing time and\nbilling charges.\n\nFor detailed pricing information for both SDKs, see [Usage and\nBilling](/maps/documentation/places/android-sdk/usage-and-billing).\n\nExpanded place types\n\nThe new SDK includes new place types, which are returned as part of the\nPlace Details and Text Search\nresponse. You can also use these new types, and the existing types, in a search\nwith Text Search. The new types are included in [Table\nA](/maps/documentation/places/android-sdk/place-types#table-a)."]]