Example of Android using Baidu map SDK to obtain location information

This article is developed using Android studio.

Obtaining location information is relatively simple. We only need the following steps:

The first step is to register baidu account, create new application and generate API on Baidu map open platform_ KEY。 I won't go into detail. Please go here: http://lbsyun.baidu.com/index.php?title=android -locsdk/guide/key

Step 2: download the SDK at: http://lbsyun.baidu.com/index.php?title=android -locsdk/geosdk-android-download

Step 3: establish the Android studio project (omitted), and configure the environment:

Put the unzipped files into the LIBS folder, create a folder called jnilibs under Src / main, and lean the unzipped folder into it, as shown in the following figure:

Step 4: Baidu lbs_ Add the environment variable (right click, add as Library) to android.jar, and add the following to Android in build.gradle of the app:

As shown in the figure:

Step 5: declare the permissions in the androidmanifest.xml file:

Add the following contents in the application tab:

Step 6: test the code and obtain the location information:

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
分享
二维码
< <上一篇
下一篇>>