Android Gaode map POI retrieval imitation wechat sending location example code

Recently, the project needs to change the sending location module into an effect similar to that of wechat sending location to friends. I used Gaode map to implement a demo. The effect diagram is as follows:

From the main interface, we can see that the center mark shows the address we locate, and the following is a listview list. The data of the first item is the address we locate, and the rest are the addresses we search around the POI according to the longitude and latitude we locate. We did the following:

The main codes are posted here. First, we initialize the map status:

We focus on the above three listening callbacks. One is location listening. There are the following two callback methods:

After successful listening and positioning at 4 locations, the onlocationchanged method will be called back. In this method, we can obtain the longitude and latitude reading and address of the location, and display the small blue dots of the custom system location set above,

Let's analyze the callback when the position of two maps changes:

The geographical positive and negative coding callbacks we made in 3 places are as follows:

Here we perform POI perimeter search and callback methods

Similar POI searches with keywords are similar:

Finally, another knowledge point is that when we click item, the map moves automatically. In fact, it is implemented by the amap.movecamera method. It will automatically call the oncamerachangefinish method, and the process is the same as that of manually dragging the map.

Basically, that's it. As for some details, you can adjust and optimize them yourself. There are no big problems. The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>