简体   繁体   English

为什么Android应用程序限制不适用于Google Directions API?

[英]Why isn't android app restriction available for google directions api?

So apparently android app restriction doesn't work when I call google directions API from my android app I still get the Your IP is restricted etc. 因此,当我从我的android应用程序调用google Directions API时,显然android应用程序限制不起作用,但我仍然收到您的IP受限制等信息。

So I apparently googled and read somewhere that Android app restriction is valid only for Google Maps Android API v2 and Google Maps Places for Android. 因此,我显然在Google上搜索并读到某个地方,说Android应用程序限制仅对Google Maps Android API v2和Android版Google Maps Places有效。

The question is why? 问题是为什么?

Directions API is a web service and it is supposed to be called from your backend server, not from mobile device directly. Directions API是一项Web服务,应该从您的后端服务器而不是直接从移动设备调用。 The API keys for web services support only IP address restriction. Web服务的API密钥仅支持IP地址限制。 So, in order to protect an API key that you are going to use with web service requests you should create an intermediate server that will send requests to Google and pass responses back to your Android app. 因此,为了保护要与Web服务请求一起使用的API密钥,您应该创建一个中间服务器,该服务器将请求发送给Google,并将响应传递回Android应用。 To protect an API key you should use an IP address of your intermediate server. 为了保护API密钥,您应该使用中间服务器的IP地址。

There is a feature request in the Google issue tracker to add services similar to Maps JavaScript API v3 directly in Maps Android API v2: Google问题跟踪器中有一项功能请求,可以直接在Maps Android API v2中添加类似于Maps JavaScript API v3的服务:

https://issuetracker.google.com/issues/35822353 https://issuetracker.google.com/issues/35822353

Feel free to star the feature request to express your interest and subscribe to further notifications. 随时为功能请求加注星标,以表达您的兴趣并订阅进一步的通知。

Hope this addresses your doubt. 希望这能解决您的疑问。

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

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