1.0.2 • Published 3 years ago

suc-cordova-background-location v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

说明

本插件用于在后台获取定位

注意

插件使用了AndroidX和kotlin,需要在config.xml中添加

<preference name="AndroidXEnabled" value="true"/>
<preference name="GradlePluginKotlinEnabled" value="true"/>

因为AndroidX与android-support冲突,请注意其他插件有没有android-support依赖

API

interface request {
    url: string,                 //必须,用于接收经纬度的url,必须接受latitude和longitude参数
    method: "get" | "post",          //必须,只能是get或post
    data: { [k: string]: any }   //可选参数,string键值对,存放希望传递的额外数据,比如用户id
}

declare type LocationManager = {
    start(arg ?: request): Promise<any>
}
  • 启动定位服务
  • 接收request作为可选参数,如果request不为空,定位成功后会根据request的内容向url传递经纬度
  • window.LocationManager.start(参数)
declare type LocationManager = {
    stop(): Promise<any>
}
  • 停止定位服务
  • window.LocationManager.stop()
1.0.2

3 years ago