如何为 Google Places api 制作 API KEY?

如何为 Google Places api 制作 API KEY?

问题描述:

这里我遇到了一个问题,我无法在 android 中访问谷歌地点 api 服务来查找附近的地点.

Here I have one problem that I can't access google places api service in android to find out nearby places.

我已经阅读了很多教程,但没有一个明确提到如何制作浏览器密钥或安卓密钥?

i have read many tutorials but none of that clearly mention how to make a browser key or android key?

这里我已经尝试了所有这些.

here i have tried all these.

1) 制作浏览器密钥并传入此查询https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=YourAPIKey

1) make a browser key and pass in this query https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=YourAPIKey

2) 制作了一个 android 密钥并在同一个查询中传递该密钥但结果始终相同并显示错误为访问被拒绝"

2) made an android key and pass that key in same query but result is always same and show error as "access denied"

谁能回答我如何制作这个api密钥和哪个(浏览器密钥或android密钥)?

can anyone answer me how can I make this api key and which one(browser key or android key)?

我一直遇到这个完全相同的问题,我也遵循了许多人的指南,但没有任何帮助.不过,我确实最终找到了正确的解决方案,并且我能够让我的应用程序正常工作.我在这里通过 stackoverflow 提出了这个问题:如何为我的 Android 应用程序获取 Google Places API 密钥

I have been having this exact same problem and I too followed the guides of many, but none helped. I did end up finding a correct solution though and I was able to get my app working. I asked the question via stackoverflow here: How do I get a Google Places API key for my Android App

收到的答案(由 user1632209 提供,再次感谢!)是:

And the answer received (Courtesy of user1632209, Thank you again!) was:

请按照以下步骤操作

-访问 Google API 控制台 https://code.google.com/apis/console 并使用您的 Google 帐户登录.

-Visit the Google APIs Console at https://code.google.com/apis/console and log in with your Google account.

-当您首次登录 API 控制台时,系统会为您创建一个名为 API 项目的默认项目.您可以使用该项目,也可以通过单击窗口顶部的 API 项目按钮并选择创建来创建一个新项目.Maps API for Business 客户必须使用为他们创建的 API 项目作为他们购买 Places for Business 的一部分.

-A default project called API Project is created for you when you first log in to the APIs Console. You can use the project, or create a new one by clicking the API Project button at the top of the window and selecting Create. Maps API for Business customers must use the API project created for them as part of their Places for Business purchase.

-点击左侧导航面板中的服务链接.

-Click the Services link in the left-hand navigation panel.

-单击 Places API 条目旁边的状态开关(开/关按钮).开关滑动到 ON.

-Click the status switch (the on/off button) next to the Places API entry. The switch slides to ON.

-点击左侧导航面板中的 API Access.

-Click API Access in the left-hand navigation panel.

- 单击创建新服务器密钥.如果您希望限制可以发送 API 请求的服务器,请输入一个或多个服务器 IP 地址.

-Click Create new Server key. Enter one or more server IP addresses if you wish to restrict the servers that can send API requests.

- 单击创建.您的 API 密钥显示在服务器应用程序的密钥标题下(带 IP 锁定).

-Click Create. Your API key appears under the heading Key for server apps (with IP locking).