【问题标题】:How to use multiple Google API with a unique API key如何使用具有唯一 API 密钥的多个 Google API
【发布时间】:2016-05-15 06:09:44
【问题描述】:

我想使用 Google Maps Distance Matrix API、Google Maps Direction API 和 Google Places API for Android 进行自动完成。

我想为所有人拥有一个唯一的 API 密钥。

在我的清单文件中添加了

<meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
<meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_geo_maps_key"/>

单独使用 PlaceAutocomplete,该键也可以正常工作。但对其他 API 给出授权错误。

  • 我已启用 API。
  • 我已在我的 Android API 中将 SHA1 指纹设置为 com.packagename debug.keystore 的 SHA1 密钥

那么如何为所有 API 使用一个 API 密钥?

【问题讨论】:

  • 我也有同样的问题... 有人请解释解决方案

标签: android api google-maps


【解决方案1】:

您在使用 Google Maps Distance Matrix API 和 Google Maps Direction API 时遇到授权错误,因为它是一种 Google Maps Javascript API,您需要为此提供服务器密钥。请参阅Directions - Get a Key/AuthenticationDistance Matrix - Get a Key/Authentication

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-08-03
    • 1970-01-01
    • 2015-10-04
    • 2017-05-05
    • 2012-10-19
    • 1970-01-01
    • 2019-04-08
    相关资源
    最近更新 更多