简体   繁体   中英

Get my country from my current location google map v2 android

I'm using Google map v2 in my android app to get my location and it works well. Now I want to get my country meaning that if I'm in Cairo or Alexandria, the code tells me that I'm in Egypt. And if I'm in New York or Washington, the code tells me that I'm in USA.

How can I do this by code?

Thanks in advance.

Use Google Reverse Geocoding API .

Sending a LatLng, you get a list of possible addresses. One of them is the country.

Example:

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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