amap_map_fluttify 0.25.0高德地圖 地圖組件 Flutter插件
第三方庫
amap_map_fluttify: ^0.25.0
amap_core_fluttify: ^0.9.5
amap_location_fluttify: ^0.14.0+1
permission_handler: ^5.0.0+hotfix.8
fluttertoast: ^4.0.1
url_launcher: ^5.5.0
配置 #
Android #
1.注意在app/build.gradle的android塊中配置簽名信息, 并在buildTypes塊中指定簽名信息, 否則將無法匹配到你在高德后臺配置的appkey, 例如:
android {
? ? signingConfigs {
? ? ? ? release {
? ? ? ? ? ? keyAlias 'amap_map_test'
? ? ? ? ? ? keyPassword 'amap_map_test'
? ? ? ? ? ? storeFile file('可以用keystore路徑替代')
? ? ? ? ? ? storePassword 'amap_map_test'
? ? ? ? }
? ? }
? ? buildTypes {
? ? ? ? debug {
? ? ? ? ? ? signingConfig signingConfigs.release
? ? ? ? }
? ? ? ? profile {
? ? ? ? ? ? signingConfig signingConfigs.release
? ? ? ? }
? ? ? ? release {
? ? ? ? ? ? signingConfig signingConfigs.release
? ? ? ? }
? ? }
}
iOS #
1.使用地圖需要使能UiKitView, 在Info.plist中添加:
<key>io.flutter.embedded_views_preview</key>
<string>YES</string>
1.定位需要聲明權(quán)限, 在Info.plist中添加:
<key>NSLocationWhenInUseUsageDescription</key>
<string>需要定位權(quán)限</string>
1.調(diào)用高德地圖需要添加白名單:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>iosamap</string>
<string>amapuri</string>
</array>
[?] Flutter (Channel stable, 1.20.0, on Mac OS X 10.15.1 19B88, locale
? ? zh-Hans-CN)
[?] Android toolchain - develop for Android devices (Android SDK version
? ? 30.0.0-rc1)
[?] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[?] Android Studio (version 4.0)
[?] VS Code (version 1.47.3)
SHA1獲取
Release:
終端引入:項(xiàng)目對應(yīng)keystore文件路徑,去掉keystore?;剀?/p>
keytool -list -v -keystore keystore
輸入keystore密碼,即可獲取。
Debug:
終端引入:項(xiàng)目對應(yīng)keystore文件路徑,去掉keystore?;剀?/p>
keytool -list -v -keystore debug.keystore
輸入keystore密碼,即可獲取。
NetworkSecurityConfig問題,http未被激活,導(dǎo)致安卓demo位置信息解析不出來。必須調(diào)用AmapView()后才會激活
具體demo查看
https://gitee.com/yelenaLei/yelena_amap
實(shí)現(xiàn)高德地圖demo目前主要有以下功能(社區(qū)版)
1.獲取當(dāng)前位置信息
2.指定經(jīng)緯度打標(biāo)簽(marker)
3.根據(jù)多個(gè)經(jīng)緯度可以繪制多邊形
4.根據(jù)中心點(diǎn)繪制范圍圓,
5.地圖實(shí)現(xiàn):定位,跟蹤定位,指南針、比例尺顯示與否的展示,地圖范圍放大縮小
6.地圖截屏
7.高德地圖app導(dǎo)航跳轉(zhuǎn)
pad沒有陀螺儀所以定位方向跟隨的時(shí)候箭頭不會旋轉(zhuǎn)
高德地圖mapview不顯示:
AndroidManifest.xml文件中增加
android:name="com.xwtec.commmanager.activity.comm.CustMapActivity"
android:hardwareAccelerated="false" >
設(shè)置android:hardwareAccelerated="true"就可以。