nativeScript-fancy-geo
您出色的 NativeScript 插件。
npm i --save nativescript-fancy-geo

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