[英]By latitude and longitude I can get address in emulator but not in android device
通过提供纬度和经度值,我可以在模拟器中获得位置,但是当我在android设备中尝试相同的代码时,尽管GPS处于打开状态,但未显示位置。
You can call the below link using asynctask to get the exact address.. 您可以使用asynctask调用以下链接以获取确切的地址。
http://maps.google.com/maps/api/geocode/json?address=lat,lng&sensor=false http://maps.google.com/maps/api/geocode/json?address=lat,lng&sensor=false
Hope you will get the address string in result like below: 希望您得到的地址字符串如下所示:
JSONArray mArray= jsonObject.getJSONArray("results");
JSONObject jb = result.getJSONObject(0);
if (jb.has("formatted_address")) {
addressText = jb.getString("formatted_address");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.