简体   繁体   English

使用Google地方信息自动完成API的REQUEST_DENIED响应

[英]REQUEST_DENIED response using Google Places Autocomplete API

I am working on android app which uses google's places autocomplete API. 我正在使用谷歌的地方自动完成API的android应用程序上工作。

When tried to hit following URL 尝试点击以下网址时

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Vict&types=geocode&sensor=false&language=en&key=apiKey https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Vict&types=geocode&sensor=false&language=en&key=apiKey

I got the response as below. 我得到如下响应。

{ "predictions" : [], "status" : "REQUEST_DENIED" } {“预测”:[],“状态”:“ REQUEST_DENIED”}

I got the API key from link below Google APIs console 我从Google API控制台下方的链接获取了API密钥

also i have enabled Google Maps API v3 service. 我还启用了Google Maps API v3服务。 As per API documentation REQUEST_DENIED response is generally due to lack of sensor parameter but which i have already provided. 根据API文档,REQUEST_DENIED响应通常是由于缺少传感器参数,但我已经提供了。 After hitting above URL directly in browser also i am getting REQUEST_DENIED response. 在浏览器中直接点击以上URL之后,我也得到REQUEST_DENIED响应。 Is anything else i have to do? 我还有什么需要做的吗?

Are you sure your key is correct and that you have enough quota left? 您确定密钥正确并且还有足够的配额吗? Try generating a new key and checking that you have the referrals correct/set to empty. 尝试生成一个新密钥,并检查引荐是否正确/设置为空。

You also may need to wait up to 5 minutes for the key to become active. 您可能还需要等待最多5分钟,才能激活密钥。

FWIW I tested your URL with my own key and it worked fine. FWIW我用自己的密钥测试了您的URL,它工作正常。

I was also facing the same issue "REQUEST_DENIED" when using google places API for my android app. 在我的android应用中使用Google Places API时,我也遇到了同样的问题“ REQUEST_DENIED”。 As per Google API console help "Android and iOS keys are only supported by some APIs, such as the Google Maps Android API or the Google Maps SDK for iOS." 根据Google API控制台帮助,“某些API仅支持Android和iOS密钥,例如Google Maps Android API或iOS的Google Maps SDK。” ( https://developers.google.com/console/help/ ). https://developers.google.com/console/help/ )。

In my case problem solved by using the 'key for bowser apps' instead of using android/iOs keys. 就我而言,通过使用“用于Bowser应用程序的密钥”而不是使用android / iOs密钥解决了问题。

The problem that you are facing is may be related to API_KEY.You inserted something like 您面临的问题可能与API_KEY有关。您插入了类似
letter "l" instead of capital "i". 字母“ l”代替大写字母“ i”。 Capital i and el(l) looks same in the xcode environment.Try to insert correct letter will solve the issue. 大写字母i和el(l)在xcode环境中看起来相同,请尝试插入正确的字母将解决此问题。

I dont see input parameter listed on API page http://code.google.com/apis/maps/documentation/places/#PlaceSearches 我在API页面http://code.google.com/apis/maps/documentation/places/#PlaceSearches上看不到输入参数

What does it do? 它有什么作用? If you really need to have it, try moving it to the last item. 如果您确实需要它,请尝试将其移至最后一项。 Or just try removing it first to see if it works. 或者只是尝试先将其删除以查看其是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM