Android foreign Google map positioning

Related detailed tutorial address: https://blog.csdn.net/hffugff/article/details/83882049
https://www.cnblogs.com/zhujiabin/p/7570960.html

Steps to achieve positioning:

  1. The most important thing is that the computer needs to bypass the wall, that is, whether it can access the external network
  2. Log in to Google's official website to apply for a key
  3. Locating Demo code Simple configuration
  4. Achieve positioning

Some problems encountered:

  1. When in China, the location always reports a null pointer (null), and the location fails.
  2. After obtaining the location, use the latitude and longitude through the Android native API method to obtain the detailed address and report an error
  3. Precautions, be sure to close the positioning in time, otherwise it may cause memory leaks

Solve related problems:

  1. Check whether the mobile phone has installed the three-piece set of Google, whether it has been bypassed, and whether the current mobile phone is abroad. When I tested it before, I used a Samsung mobile phone. Since the mobile phone is in China , the location cannot be obtained . After verification, use the Android emulator to set the latitude and longitude of the mobile phone to a foreign country, and the latitude and longitude set by the emulator can be obtained to achieve successful positioning. It may be the reason of the Celestial Dynasty that Google Maps is blocked in China.
  2. Some models will report java.io.IOException: grpc failed. After checking the error, the method geocoder.getFromLocation() is not supported .

Guess you like

Origin blog.csdn.net/u013290250/article/details/103085534