Android: Get current location in China

守給你的承諾、 提交于 2019-12-10 00:40:39

问题


I need to get current location in China but current location manager is not working in china.Its not showing latitude and longitude. Please tell me how can I get this? Many Thanks


回答1:


Fact 1: All Google services are blocked in China.

Fact 2: Although it gives a feeling that AOSP is nothing to do with Google, it's really not.

The truth is that once you used NETWORK_PROVIDER to get a location, a message was send to Google location server to check out the location, and returned the location back to you. For the reason every Chinese knows about, you can't access the server, that's why when you combine NETWORK_PROVIDER and GPS_PROVIDER together, debug codes in a room, nothing get returned(GPS is not accessible in a room).

Solution:

  1. Use android ROM modified by Chinese company like XIAOMI, MEIZU etc. These ROMs modify the framework and redirect the NETWORK_PROVIDER message to other servers.

  2. Use some third-party location service like BAIDU location SDK.



来源:https://stackoverflow.com/questions/27244724/android-get-current-location-in-china

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!