为什么Google放置API密钥不起作用? [英] Why Google places API key not works?
问题描述
我希望使用Places API进行位置附近的展示。我为它添加了服务并使用了下面的url。
https://maps.googleapis.com/maps/api/place/search/json?location=22.7253,75.8655&radius=500&sensor=true&types=bar&key=mykey
它会返回以下错误。
{error_message:此IP,网站或移动应用程序未被授权使用此API密钥。,
html_attributions:[],
results:[],
status:REQUEST_DENIED
}
看起来您尝试使用Web服务,而不是Android的Places API。在这种情况下,您无法应用Android应用程序限制的API密钥。 Web服务需要不同的API密钥。您可以生成新的,您可以在Web服务中使用的唯一限制是IP。
我可以推荐以下Places API网页服务文档:
https://developers.google.com/places/web-service/get-api-key
I want to use Places API for show near by location.I have added service for it and use below url. https://maps.googleapis.com/maps/api/place/search/json?location=22.7253,75.8655&radius=500&sensor=true&types=bar&key=mykey
It returns the following error. { "error_message" : "This IP, site or mobile application is not authorized to use this API key.", "html_attributions" : [], "results" : [], "status" : "REQUEST_DENIED" }
It looks like you try to use Web Service, not Places API for Android. In this case you cannot apply an API key with Android app restriction. Web Service requires a different API key. You can generate the new one, the only restriction that you can use with web services is by IP.
I can suggest following Places API web service documentation:
https://developers.google.com/places/web-service/get-api-key
这篇关于为什么Google放置API密钥不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!