Google directions returns REQUEST_DENIED when call

2019-07-19 15:53发布

I am sending a HTTP request to Google Directions and I keep getting REQUEST_DENIED from my Android app. I already checked the SHA-1 that I had configured in the API key in Google console and also made sure that the directions API is enabled for my project. Am I missing something?

1条回答
叛逆
2楼-- · 2019-07-19 16:29

Check the api key you are using from the android app is unrestricted. Google Maps Directions does not support android restricted keys yet, only IP addresses restrictions (which u can't do for android apps)

From documentation:

Google Maps APIs are available via HTTP web services, for web browsers, and Android or iOS apps. APIs in any platform can use a generic (unrestricted) API key. You can optionally add a restriction (for example, IP addresses) to the API key. Once restricted, a key will only work on platforms that support that type of restriction.

Tip: Before moving your app or website to production, you should secure your API key. Keys for the Google Maps Directions API use the IP addresses (web servers, cron jobs, etc.) key restriction

查看更多
登录 后发表回答