【问题标题】:Can I use Google Places API without a personal Website?我可以在没有个人网站的情况下使用 Google Places API 吗?
【发布时间】:2014-06-18 23:14:59
【问题描述】:

好的,所以,也许我只是不了解 Google Places API,或者我在学习教程方面一直很失败,但无论哪种方式,我都可以使用一些帮助。

我正在制作一个 android 应用程序,其中屏幕放大到它们所在的位置,并使用谷歌位置搜索硬编码的字符串位置。 (即,您住在加利福尼亚州的洛杉矶;离您最近的麦当劳位于此处*)。然后它会在地图上显示该地点。

当我按照我发现的每个教程获取 Google 地方的 API 密钥(即:https://www.youtube.com/watch?v=8PVK1Ue5rvk)时,它说我需要输入一个网址才能获得一个(见下图)

-----(照片之间的差距)---------------------------------- ------------

-- 但是我没有可以放在这里的网站或 URL,因为我只是为我的 android 设备写这个。 我需要获取网站主机 URL 才能使用它吗? 有没有我没听说过的通用 URL? 我这样做是完全错误的吗?

我还从这里复制并粘贴了代码:http://www.androidhive.info/2012/08/android-working-with-google-places-and-maps-tutorial/ 我可以运行它,但是我在 logcat 中收到的错误是 Places Status : REQUEST_DENIED 这让我觉得我需要用自己的密钥更改部分代码。

我确实已经有一个 Google Maps API 密钥,我在应用程序中使用它。

提前感谢您的宝贵时间和帮助!

-Sil

编辑:查看附加图片:

【问题讨论】:

    标签: android google-maps


    【解决方案1】:

    请参阅您突出显示的 [浏览器键] 按钮旁边的 [Android 键] 按钮。

    点击那个 [Android key] 按钮。

    ;)

    【讨论】:

    • 斯蒂芬,确实!那将是最合乎逻辑的,但我已经这样做了,并且正在使用其中的 API 密钥。错误仍然存​​在。我从那里收到的 API 密钥与我将用于地方信息的 API 密钥不同吗?
    • 您现有的 Google 地图密钥,它适用于哪个版本的 Google 地图?请注意,您使用的教程是 2012 年的,早于新的 Android Google Maps api 出现的时间。
    • Stephan,我编辑了上面的帖子以显示我 2 天前制作的 Android 密钥。这是 Places 所需的唯一键吗?我从教程中得到的印象是 Places 的 Key 与 maps 不同。
    【解决方案2】:

    好吧,事实证明我的措辞措辞不佳:(

    我在这里改写了我要查找的内容:How do I get a Google Places API key for my Android App

    我收到的答案是:

    Please Follow below steps
    Visit the Google APIs Console at https://code.google.com/apis/console and log in with your Google account.
    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.
    Click the status switch (the on/off button) next to the Places API entry. The switch slides to ON.
    Click API Access in the left-hand navigation panel.
    Click Create new Server key. Enter one or more server IP addresses if you wish to restrict the servers that can send API requests.
    Click Create. Your API key appears under the heading Key for server apps (with IP locking).
    

    这完全解决了我遇到的问题。

    感谢您花时间帮助斯蒂芬,我很感激您让我朝着正确的方向前进

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-29
      • 2020-10-23
      相关资源
      最近更新 更多