在 Android 上安全地使用浏览器密钥 Google 放置 API Web 服务
Safely Using a Browser Key for Google Places API Web Service on Android
我一直在使用 Google Places API for Android Autocomplete Widget by embedding the PlaceAutocompleteFragment
into my activity. This works alright, but has several drawbacks for my implementation stemming from the widget's performance and the lack of the radius filter that is available in the full Google Places API Web Service。
我想开始离开 Google 的地方 API Android 并使用 Google 放置 API Web 服务 以访问更广泛的过滤选项。但是,文档说明如下:
Note: The Google Places API Web Service does not work with an Android or iOS restricted API key.
这意味着,我假设,我必须在我的应用程序中使用浏览器或服务器限制 API 密钥,但在 Android 上,我知道这些选项不太理想,因为窃取 API 密钥成为可能。
如何在我的 Android 应用程序中安全地使用浏览器 API 密钥?
Web 服务应该从您的后端服务器调用。 Web服务的API键支持IP地址限制。因此,为了保护您将用于 Web 服务请求的 API 密钥,您应该创建一个中间服务器,它将请求发送到 Google 并将响应传回给您的 Android应用程序。要保护 API 密钥,您应该使用中间服务器的 IP 地址。
我一直在使用 Google Places API for Android Autocomplete Widget by embedding the PlaceAutocompleteFragment
into my activity. This works alright, but has several drawbacks for my implementation stemming from the widget's performance and the lack of the radius filter that is available in the full Google Places API Web Service。
我想开始离开 Google 的地方 API Android 并使用 Google 放置 API Web 服务 以访问更广泛的过滤选项。但是,文档说明如下:
Note: The Google Places API Web Service does not work with an Android or iOS restricted API key.
这意味着,我假设,我必须在我的应用程序中使用浏览器或服务器限制 API 密钥,但在 Android 上,我知道这些选项不太理想,因为窃取 API 密钥成为可能。
如何在我的 Android 应用程序中安全地使用浏览器 API 密钥?
Web 服务应该从您的后端服务器调用。 Web服务的API键支持IP地址限制。因此,为了保护您将用于 Web 服务请求的 API 密钥,您应该创建一个中间服务器,它将请求发送到 Google 并将响应传回给您的 Android应用程序。要保护 API 密钥,您应该使用中间服务器的 IP 地址。