Summary of Android integration with Google Maps

1 Introduction:

There are two ways to integrate Google Maps in Android applications:

1) In the form of a fragment, select "Google Maps Activity" when creating the project. Personally, I feel that this method is inconvenient in actual use. I will not introduce it here. If you are interested, you can refer to this Daniel's blog ( https://blog.csdn.net/kmyhy/article/details/60344699 )
2) Adding Google map components in the xml file in the form of controls is a more traditional way of integrating maps. Here I will introduce my personal experience in this way.

2. Preparation before development:

1) To install an APP integrated with Google Maps on a domestic Android mobile phone, first of all, the mobile phone must install Google's three-piece set: Google service framework, Google play store, and Google play service. (You can download it yourself from the app store, or you can download the "Google Installer", which will automatically detect the apps you need on your phone.)

2) The mobile phone needs to be over the wall. (Otherwise, the map will be blank, and some functions such as route planning will not be possible.)

3) The development tool must add "Google paly service", and the dependency of Google paly service must also be added to the project build.gradle file. ( How to add "Google play service" in Android studio )

4) Apply for a Google map certificate, that is, the API key Key. (This step is similar to the domestic Baidu map and Gaode map, just refer to the official documentation)

so you can start

3. Project development

1) Create a project. For project configuration, adding map applications, positioning, etc., you can refer to Google's official documentation ( https://developers.google.com/maps/documentation/android-api/map?hl=zh-cn )
2) Regarding positioning, after the positioning is successful, the resolved address is correct, but the location displayed on the map is not accurate. This is a normal situation, because Google has added bias to our country, and I don’t know what it means.
3) Regarding the method of parsing location information and reverse geocoding, I recommend a blog here and express my gratitude (Google Maps reverse geocoding https://blog.csdn.net/shao941122/article/details/52291907 )
4) About the route Planning, Google does not officially provide developers with an API for route planning (at least I didn't find it), or read the blog again and ask for help (Google Maps Route Planning http://blog.csdn.net/mad1989/article/details /9734667 )

Problems encountered in development

1) The map display is incomplete. After dragging, the map is blurred and unclear – the phone does not overturn the wall.
2) The planned route is not displayed – the mobile phone does not overturn the wall.

Description: I'm just briefly talking about the process of integrating Google Maps in Android, because it was used in the previous project, and I searched everywhere, only to come up with a slightly decent one. Summarize some problems encountered in the development, I hope to help everyone. And thanks to the bloggers mentioned above. Due to confidentiality issues, it is inconvenient to provide the code, please understand.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324820896&siteId=291194637