Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
770 views
in Technique[技术] by (71.8m points)

use multiple Google Maps API Keys for same server?

I have a server which acts as a mesh. I have 3 mobile apps, each having it's own google maps api Key all three apps call my server which calls the google apis with the specific app key.

so App1 has key1 App2 has Key 2 App3 has key 3

when I need the directions for App1, my server calls google api with key 1 when I need the directions for App2, my server calls google api with key 2 when I need the directions for App3, my server calls google api with key 3

So my server works like an API mesh. Is this against google terms? I am afraid they will look at the ip address of the server, see there are 3 keys used and assume I am using different Keys for same applications which is prohibited.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The short answer (drawn from the FAQ) is quite simply : no, you can't use two keys in this case.

See https://developers.google.com/maps/faq#usage_avoidance - they even reserve "the right to withhold access to the maps API from any site" doing so, just as you feared.

Using more than one key, even though it could only be a matter of convenience for you, means for them trying to cheat and bypass the limitation of 25,000 requests per day and per service. And they don't like that, because they want big users of their maps API to pay, of course. Prices are listed on the same page.

You should read the FAQ paragraphs "Understanding the Terms of Service" and "Usage limits" completely - it is quite short but sometimes a little tricky. You'll see that there are a few situations in which you do not actually have to pay even when exceeding limitations :

  • you are using the google earth API
  • you are using a native maps API from a mobile platform
  • you are showing a google map through an embed only
  • your apps are "in the public interest (as determined by Google at its discretion)"

Also, you do not always need to provide an API key, though these products may still be available for limited use only : take for instance the geocoding API.

I guess you're not in one of those cases (at least bullets 2 and 3) since your calls transit through your server. Using the native APIs in mobile apps would solve the problem, but it does mean quite some development I guess.

It is also worth noting that you should apply for a special maps API for business license for some use cases, e.g. when only paying users get to see your map.

In conclusion, you need to have one single google maps API key when it comes to using their products that require one. Or rather, at most one per domain name.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...