我是Android编程的新手,我想知道它是否可能以及如何从当前位置(我甚至不知道如何检索它)恢复该区域和省。
请你发一些代码或告诉我在哪里可以找到它?
感谢!!!!!!
利玛
答案 0 :(得分:0)
安卓电话中的GPS跟踪:
您可以使用Android位置管理器检索手机的当前位置。 教程参考:GPS Tracking
可用长期的反向地理编码:
要获取地区和省份,在通过手机获取当前的lat / long后,您可以使用可通过网络服务使用的Google反向地理编码API。
Google Reverse Geo-coding API是:https://maps.googleapis.com/maps/api/geocode/json?
用法将是一个GET REQUEST,如:https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452
(如果您只是在浏览器中复制并粘贴URL,则不会得到回复)
(限制使用也不需要API密钥)
答案 1 :(得分:0)
首先,find the location of your user using the Location Manager. Then, pass the location to Google's Geocoder for the address(它包含州,省等)
答案 2 :(得分:0)
你也可以使用Geocoder类的方法(android.location):http://developer.android.com/reference/android/location/Geocoder.html