Giter Site home page Giter Site logo

spellsuvam / flutter_amap_track Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lunagao/flutter_amap_track

0.0 0.0 0.0 799 KB

高德地图猎鹰服务Flutter插件,支持Android&iOS

Home Page: https://github.com/ColdPuppy/flutter_amap_track

License: MIT License

Ruby 2.08% Objective-C 27.49% Java 24.31% Dart 46.12%

flutter_amap_track's Introduction

flutter_amap_track

pub package

本插件为高德猎鹰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>

iOS

添加时注意:

  1. 删除flutter_amap_track-umbrella.h 文件中的 #import "ObjFlutterAmapTrackPlugin.h" 这行代码。
  2. 点击Pod项目,选择flutter_amap_track这个target,选择Build Phases, 点开Headers,移动ObjFlutterAmapTrackPlugin.h文件到Private下。

更改info.plist 及 配置后台定位

在info.plist的字段添加定位权限的申请及配置后台定位能力,配置方式请参考iOS 猎鹰SDK 手动部署部分说明

设置apikey

AmapTrack.getInstance().setIOSApiKey('xxx');

使用

全局设置serviceId并初始化猎鹰组件

    AmapTrack.getInstance().initWithServiceId(xxx);

终端管理

  1. 查询终端
try {
	var response = await AmapTrack.getInstance()
		.queryTerminal(QueryTerminalRequest(
			terminal: terminalName));
	...
  } on ErrorResponse catch (e) {
	print('${e.errorCode} | ${e.errorMsg} | ${e.errorDetail}');
  }
  1. 创建终端
try {
	var response = await AmapTrack.getInstance()
		.addTerminal(
			AddTerminalRequest(terminal: terminalName));
	...
  } on ErrorResponse catch (e) {
	...
  }

轨迹上报

  1. 开启轨迹服务
await AmapTrack.getInstance().startTrack(TrackParam(tid:  tid,trid: trid));
  1. 开启定位采集
await AmapTrack.getInstance().startGather();
  1. 结束定位采集
await AmapTrack.getInstance().stopGather();
  1. 结束轨迹服务
await AmapTrack.getInstance().stopTrack(TrackParam(tid: tid,trid: trid));

轨迹查询

  1. 查询终端实时位置
var latestPoint = await AmapTrack.getInstance().queryLatestPoint(LatestPointRequest(tid: tid));
  1. 查询终端行驶里程
var distanceResponse = await AmapTrack.getInstance().queryDistance(DistanceRequest(...));
  1. 查询终端所有轨迹点
var historyTrackResponse = await AmapTrack.getInstance().queryHistoryTrack(HistoryTrackRequest(...));
  1. 查询终端某个轨迹的轨迹点
var queryTrackResponse = await AmapTrack.getInstance().queryTerminalTrack(QueryTrackRequest(...));

本插件API更多参考的是官方Android猎鹰API,兼容了iOS部分,更多api及参数可前往官网查询

flutter_amap_track's People

Contributors

coldpuppy avatar lunagao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.