0 purchases
byn tencent map
byn_tencent_map #
用于在iOS和Android应用程序中集成腾讯地图的Flutter插件
目前只集成了单次获取定位功能,地图选点功能。
Getting Started #
集成腾讯地图android版本 #
1、先申请一个key
https://lbs.qq.com/mobile/androidMapSDK/developerGuide/getKey
2、在AndroidManifest.xml的application标签中配置key
开发者申请key后,把Key输入工程的AndroidManifest.xml文件中,在application标签里,添加名称为TencentMapSDK的meta,如下所示(value值为申请的key):
<meta-data
android:name="TencentMapSDK"
android:value="*****-*****-*****-*****-*****-*****"/>
copied to clipboard
集成腾讯地图ios版本 #
1、申请一个key
https://lbs.qq.com/mobile/androidMapSDK/developerGuide/getKey
直接在dart文件中设置key
import 'package:byn_tencent_map/byn_tencent_map.dart';
void main(){
if (Platform.isIOS) {
TencentMap.initIOSSdk("*****-*****-*****-*****-*****-*****");
}
runApp(new MyApp());
}
copied to clipboard
2、在info.plist中增加:
<key>NSLocationWhenInUseUsageDescription</key>
<string>要用定位</string>
copied to clipboard
怎么用 #
先导入dart包
修改pubspec.yaml,增加依赖:
dependencies:
byn_tencent_map: ^0.1.3
copied to clipboard
在要用的地方导入:
import 'package:byn_tencent_map/byn_tencent_map.dart';
copied to clipboard
单次获取定位:
MapPoiData? data = await TencentMap.getLocation();
copied to clipboard
添加地图选点:
TencentMapView(
onPick: (data) {
print("TencentMap onPick poi: ${data.toJson()}");
},
),
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.