简体   繁体   中英

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..

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");
}

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