Android Studio实现百度地图定位
1.注册和获取密钥
获取开发密钥(AK)
获取包名
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.baidupos">
获取SHA1
2.在项目中集成BaiduMap SDK
往工程中添加jar文件
在工程配置中需要将前面添加的jar文件集成到我们的工程中
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation files('libs\\BaiduLBS_Android.jar')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
3.显示地图
第一步 配置AndroidManifest.xml文件
1.在中加入如下代码配置开发密钥(AK):
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="3uf6CGGgsGPeKWLPBe9R1a86ztgXAAI3" />
2