Last updated:
0 purchases
flutter amap track
flutter_amap_track #
本插件为高德猎鹰Api的搬运和实现
Android猎鹰文档
iOS猎鹰文档
Android #
配置高德key
为了保证高德 Android SDK 的功能正常使用,您需要申请高德 Key 并且配置到项目中。在项目的 “AndroidManifest.xml” 文件中,添加如下代码:
<application
android:icon="@drawable/icon"
android:label="@string/app_name" >
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="请输入您的用户Key"/>
……
</application>
copied to clipboard
iOS #
更改info.plist 及 配置后台定位
在info.plist的字段添加定位权限的申请及配置后台定位能力,配置方式请参考iOS 猎鹰SDK 手动部署部分说明
设置apikey
AmapTrack.getInstance().setIOSApiKey('xxx');
copied to clipboard
使用 #
全局设置serviceId并初始化猎鹰组件
AmapTrack.getInstance().initWithServiceId(xxx);
copied to clipboard
终端管理
查询终端
try {
var response = await AmapTrack.getInstance()
.queryTerminal(QueryTerminalRequest(
terminal: terminalName));
...
} on ErrorResponse catch (e) {
print('${e.errorCode} | ${e.errorMsg} | ${e.errorDetail}');
}
copied to clipboard
创建终端
try {
var response = await AmapTrack.getInstance()
.addTerminal(
AddTerminalRequest(terminal: terminalName));
...
} on ErrorResponse catch (e) {
...
}
copied to clipboard
轨迹上报
开启轨迹服务
await AmapTrack.getInstance().startTrack(TrackParam(tid: tid,trid: trid));
copied to clipboard
开启定位采集
await AmapTrack.getInstance().startGather();
copied to clipboard
结束定位采集
await AmapTrack.getInstance().stopGather();
copied to clipboard
结束轨迹服务
await AmapTrack.getInstance().stopTrack(TrackParam(tid: tid,trid: trid));
copied to clipboard
轨迹查询
查询终端实时位置
var latestPoint = await AmapTrack.getInstance().queryLatestPoint(LatestPointRequest(tid: tid));
copied to clipboard
查询终端行驶里程
var distanceResponse = await AmapTrack.getInstance().queryDistance(DistanceRequest(...));
copied to clipboard
查询终端所有轨迹点
var historyTrackResponse = await AmapTrack.getInstance().queryHistoryTrack(HistoryTrackRequest(...));
copied to clipboard
查询终端某个轨迹的轨迹点
var queryTrackResponse = await AmapTrack.getInstance().queryTerminalTrack(QueryTrackRequest(...));
copied to clipboard
本插件API更多参考的是官方Android猎鹰API,兼容了iOS部分,更多api及参数可前往官网查询 #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.