从Android调用时,Google路线返回REQUEST_DENIED [英] Google directions returns REQUEST_DENIED when called from Android

查看:36
本文介绍了从Android调用时,Google路线返回REQUEST_DENIED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在向Google Directions发送HTTP请求,但我一直在从Android应用中获取 REQUEST_DENIED .我已经检查了我在Google控制台的API密钥中配置的SHA-1,并且还确保为我的项目启用了Directions API.我想念什么吗?

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?

推荐答案

检查您从android应用中使用的api密钥是否为不受限制. Google Maps Directions不支持android受限键,但仅支持IP地址限制(您不能为android应用执行此操作)

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)

摘自文档:

Google Maps API可通过HTTP Web服务,Web浏览器以及Android或iOS应用程序使用.任何平台中的API都可以使用通用(不受限制的)API密钥.您可以选择将限制(例如IP地址)添加到API密钥.一旦受到限制,密钥将仅在支持该类型限制的平台上起作用.

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.

提示:在将应用程序或网站移至生产环境之前,应确保您的API密钥安全. Google Maps Directions API的密钥使用IP地址(Web服务器,cron作业等)密钥限制

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

这篇关于从Android调用时,Google路线返回REQUEST_DENIED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆