First, the location city is based on the Map service API.
GPS positioning the city requires two steps:
1, to obtain the user's current location of longitude, latitude.
2. Convert to city name according to latitude and longitude.
You can only use map services when you convert to city name by latitude. I can't do it by myself.
There are two Map service APIs, one is Baidu map, the other is Google map. Baidu Map API calls need to register Baidu account, and apply for App_key, Google Maps API directly call can.
Baidu Map API call Address: http://api.map.baidu.com/geocoder?output=json&location= latitude, longitude &key=app_key
Google Maps Service API call address: http://maps.google.com/maps/api/geocode/json?latlng= latitude, longitude &language=zh-cn&sensor=true
You can set the return data format, JSON, or XML.
* On Android, parsing JSON is simpler than parsing XML.
Baidu Map API Return Data Format Description can be found in the link: http://dev.baidu.com/wiki/mapws/index.php?title=Geocoding
Google Maps API return data format more detailed, specific data format, you can see the output of this link: http://maps.google.com/maps/api/geocode/json?latlng=22.552549,113.951320 &language=zh-cn&sensor=true
How to parse JSON is not covered in this article.
Android GPS location, get city name