android - 如何将 Google API key 限制为 PhoneGap "Android App"

标签 android google-maps google-cloud-platform phonegap

我正在尝试限制 Google map API key ,以便它们只能加载到特定的 Android 应用程序上。如果我不使用任何限制,那么该 key 在应用程序中可以正常工作,因此我 100% 确定该 key 是正确的。

但是,当我在 Google 控制台中添加对 API key 的限制时, map 将停止在应用程序上加载。我遵循正确的说明来限制对特定包名称 (com.appname) 的访问,并且也使用了正确的指纹。

这是一个 PhoneGap/Cordova 应用程序,因此不是 native Android 应用程序。这就是限制不起作用的原因吗?

最佳答案

我根据@xomena 评论逐字引用了官方文档:

Before moving your app or website to production, you should secure your API key. Keys for the Maps JavaScript API use the HTTP referrers (web sites) key restriction. Learn more about keys and credentials.

To add web browser restrictions to an existing, generic API key, do the following:

  1. Go to the Credentials page of the Google API Console.
  2. Select the project that contains the API key you want to edit.
  3. On the Credentials page, from the list of API keys, select the name of the API key to edit the details of the key.
  4. In the Key restriction section of the page, select HTTP referrers (web sites), follow the on-screen instructions to set referrers, then click Save.

关于android - 如何将 Google API key 限制为 PhoneGap "Android App",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50156508/

相关文章:

python - 使用 python 3 从 googlemaps api 响应中提取数据

python-3.x - 如何从 requirements.txt 在 Google Cloud Functions 中安装最新的库版本

java - 我收到 Auth Error : Authentication failure due to [java. io.FileNotFoundException: while implementation pusher-js in Android studio

java - 如何在android中从SQLite数据库获取名称

java - Android 日历布局

ios - iOS 中的 CleverTap 通知设置

python - 云构建步骤中的云运行集成测试?

Android 使用 Spinner 和 MultiAutoCompleteTextView 自动填充列表项

google-maps - 如何设置透明叠加 WMS 图层的样式

javascript - Google Maps API v3 - 基于 IP 的地理位置