Android integrated Baidu map development process and precautions

preface

Recently, the company wanted to integrate Baidu maps into the project, so I studied the SDK of Baidu maps for one day. The current version: Android SDK V3.0.0. Although there are many relevant codes on Baidu map online, most of them may be older versions, and the changes of Baidu map API feel relatively large, so I'd like to share with you the implementation process and precautions

1、 Request key

Key and difficult points: obtain SHA1 value of Android signature certificate

Method 1: use keytool

Enter the command prompt

Get the SHA1 value of debug:

Locate the. Android folder and enter keytool - List - V - keystore debug.keystore to get three fingerprint certificates. Select SHA1 type certificate (the key password is Android)

Get the SHA1 value of release:

Locate the folder of signature file xxx.keystore and enter keytool - List - V - keystore xxx.keystore to get three kinds of fingerprint certificates. Select SHA1 type certificate (the key password is customized before)

Method 2. In eclipse, view it directly in ADT

Click windows - > preference - > Android - > build in the toolbar

2、 Import library file

You'd better directly copy the. So file and jar package in the demo. Don't forget locsdk.so and locsdk.jar

Configure the use of so in build.gradle

3、 Configure the androidmanifest.xml file

(1) Declare permissions

(2) Declare the service component in the application tag, and each app has its own positioning service

(3) Set acesskey

4、 Initialize SDK in application

Note that the application is configured in the androidmainfest.xml file

5、 Positioning function package

use

(1) . declare location result callback

(2) . bind the service in oncreate()

(3) . cancel the service in ondestroy()

summary

The above is the whole content of this article. I hope it can be helpful to Android developers. If you have any questions, you can also leave a message.

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