npm i --save nativescript-fancy-geo
- 版本:0.0.1
- GitHub:
- NPM: https://npmjs.net.cn/package/nativescript-fancy-geo
- 下载
- 昨天: 0
- 上周: 0
- 上个月: 0
NativeScript Fancy Geo
npm i nativescript-fancy-geo
用法
TypeScript
import { TNSFancyGeo, TNSFenceTransition } from 'nativescript-fancy-geo'
let lat = 10.6918;
let lon = 61.2225;
TNSFancyGeo.hasPermission()
.then(()=>{
let notification = {id: 0, title: "Test", body: "Test Body"};
let circle = {
id: null,
transition: TNSFenceTransition.ENTER_EXIT,
notification,
loiteringDelay: 0,
points: [lat, lon], radius: 1000
};
TNSFancyGeo.createCircleFence(circle);
}).catch(()=>{
TNSFancyGeo.requestPermission({always: true})
})
Api
方法 | 默认 | 类型 | 描述 |
---|---|---|---|
setOnMessageListener(listener: Function) | |||
createCircleFence(options: FenceOptions) | Promise |
||
hasPermission() | Promise |
||
requestPermission(options: PermissionOptions) | Promise |
||
getCurrentLocation(options: LocationOptions) | Promise |
||
getAllFences() | Promise |
||
getFence(id: string) | Promise |
||
removeAllFences() | Promise |
||
removeFence(id: string) | Promise |