谷歌地图 API KEY 用于测试

GoogleMaps API KEY for testing

我想为 GoogleMaps 添加一个 API_KEY 用于测试,在文档中我读过这个:

Tip: During development and testing, you can register a project for testing purposes in the Google Cloud Platform Console and use a generic, unrestricted API key. When you are ready to move your app into production, register a separate project for production, create an Android-restricted API key, and add the key to your application.

我的问题是,即使是测试 API_KEY,我是否也必须使用我的信用卡?我不知道如何使用我的 Creadit 卡 Google 地图,它不是免费的吗?

更新答案

自 2018 年 6 月 11 日起,现在必须有一个结算帐户才能获取 API 密钥。您仍然可以对地图 JavaScript API 和街景静态 API 进行无键调用,这将 return 可用于开发的低分辨率地图。启用计费仍会为您的项目提供每月 200 美元的免费赠金。

这个答案不再有效

只要您使用的是测试 API 密钥,就可以免费注册和使用。但是,当您将应用程序提升到商业级别时,您必须为此付费。当您启用计费时,google 每月免费赠送 200 美元信用额度,这意味着如果您的应用的地图使用率较低,即使在启用计费后您仍然可以免费使用它,如果超过信用额度现在您必须付费为此。

似乎没有办法在没有信用卡的情况下免费获得 google 地图 api 钥匙。要测试 google 地图的功能,您可以在离开 api 键字段 "EMPTY" 的同时使用它。它将显示一条消息说 "For Development Purpose Only"。这样您就可以测试 google 地图功能,而无需输入 google 地图 api 键的帐单信息。

<script src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap" async defer></script>

你可以测试一下: 它将显示一条消息“仅用于开发目的”。这样一来,您就可以测试 Google 地图功能,而无需为 Google 地图 API 键输入帐单信息。

<script src="https://maps.googleapis.com/maps/api/js?sensor=false&callback=myMap"></script>

首先 Google 云计费帐户向您的帐户加载了 300 美元(用于试用目的),之后如果您允许他们开始收费,否则他们不会自动向您收费。如果您有兴趣了解如何获得 Google Maps API Key 的整个过程,请阅读这篇文章,这篇文章写得很详细。 How To Create Google Maps API KEY For Free?