flutter引入高德地图_【Flutter】集成高德地图

Android:

...

android:name="com.amap.api.v2.apikey"

android:value="您的Key"/>

在应用级build.gradie内的dependencies导入implementation “com.amap.api:location:latest.integration”。

配置defaultContig multiDexEnabled ture。

Ios:

在配置ios环境之前,你需要在项目执行:cd ios , pod install安装依赖

由于与andorid不同,iOS端设置的key在实例之中:

await AMap.init('您的key'); // 这个方法在Android端无效

AmapLocation().getLocation(LocationClientOptions(

isOncelLocation: true

)).then((res) {

print(res);

});

由于amap-base-flutter二端实现的方式不同,因此你需要将amap封装成独立包,扩展统一的api使用。

别忘记在xcode中Info.plist添加NSLocationAlwaysAndWhenInUseUsageDeion、NSLocationAlwaysUsageDeion 、NSLocationWhenInUseUsageDeion、NSLocationAlwaysAndWhenInUseUsageDescription、NSLocationWhenInUseUsageDescription权限,具体可参考:

https://blog.csdn.net/u011154007/article/details/52915566

配置后台定位权限,打开xcode runner 》 targets 》 runner 》 capabilities 》 background modes 》 勾选 location updates。

设置模拟器坐标, xcode 》 模拟器(simuator) 》 dubug 》 location 》 custon location。

修改apple clang – language的compile soures as: objective-c++。

在info.plist中中文件新增一行io.flutter.embedded_views_preview为true。参考嵌入支持的iOS视图已经降落在主

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值