0

I've tried to get city information for china users

http://maps.google.cn/maps/api/geocode/json?latlng=39.934574,116.342378&key=MyAPI

It wasn't worked

http://maps.google.cn/maps/api/geocode/json?latlng=39.934574,116.342378

I removed key and try again

works fine

MyAPI key don't need anymore in china? If so Why google request to set API key in other country? And why not request in china?

How I set my API Key to get city information in china

just remove my key?

xomena
  • 31,125
  • 6
  • 88
  • 117
Shawn Baek
  • 1,928
  • 3
  • 20
  • 34

1 Answers1

3

The first request with an API key didn't work, because a Server API key requires https protocol. Unfortunately, maps.google.cn domain does not support https [1].

[1] https://developers.google.com/maps/faq#china_ws_access

Web Service request without an API key apparently supports http protocol, so you can get results.

The difference between request with API key and request without an API key consists in how Google calculates your usage.

When you apply API key your usage is calculated against the developer console project. When you don't apply API key your usage is calculated against IP address. You have 2500 daily requests, but if you share the same IP address with somebody else, you will be unable to use all 2500 daily requests. That's why an API key is recommended.

In your case requests without an API key might be a workaround, but you cannot be sure that your daily usage will reach 2500.

xomena
  • 31,125
  • 6
  • 88
  • 117
  • Thank you so much. I have one more question. Is the ip means client's ip right? If the 10 users downloaded my app from app store then users can 2500 request daily per user? – Shawn Baek Jun 08 '16 at 23:15
  • Here I am not sure, users can be behind a NAT, so in such situation Google will see IP address of NAT server and many users may share 2500 requests per NAT IP. – xomena Jun 08 '16 at 23:32
  • I understand :) Thank you for helping me – Shawn Baek Jun 09 '16 at 03:49