Current location - Quotes Website - Personality signature - How to get the key of Baidu map API and call Baidu map API?
How to get the key of Baidu map API and call Baidu map API?
1. Log in to Baidu account.

Visit the API console page. If you don't log in to Baidu account, you will enter the Baidu account login page, as shown below:

2. Log in to the API console

After logging in, you will jump to the API console service, as shown in the following figure:

Create an application

Click "Create Application" to enter the page of creating AK, enter the application name, and change the application type to "Android SDK":

4. Configure the application

After the application type is selected as "Android SDK", you need to configure the security code of the application, as shown in the following figure:

Get a secure password

The composition rule of security code is: SHA 1 value of Android signature certificate+package name, for example:

sha 1:BB:0D:AC:74:D3:2 1:e 1:43:67:7 1:9B:62:9 1:AF:a 1:66:6E:44:5D:75

Package name: com.baidumap.demo

Android application obtains packagename, and the location varies according to different development tools:

1, developed with Eclipse.

The package name is the name defined by the Android application itself in AndroidManifest.xml, for example:

2. develop with Android Studio.

The package name needs to query the applictionId in the build.gradle file, for example:

There are two ways to obtain the SHA 1 value of the Android signing certificate:

The first method: use keytool.

Step 1: Run to the console.

Step 2: Navigate to. Android folder, go to cd.android

Step 3: enter keytool-list-v-keystordebug. keystore, and you will get three kinds of fingerprint certificates. Select the certificate of SHA 1 type (the key password is android), for example:

Among them, keytool is jdk's own tool; Keystorefile is a certificate file signed by Android.

The second method: in Eclipse, view it directly in adt 22.

If you use adt 22, you can view it directly in Eclipse:Windows-- >. Preference-> Android-& gt; Construction. As shown in the following figure:

The value of "SHA 1 fingerprint" is the SHA 1 value of the Android signature certificate.

6. Successfully created AK

After entering the security code, click "OK" to complete the configuration of the application, and you will get a created AK. Please take care of the AK you applied for. Here you can use the new AK to complete your development work.