【发布时间】:2021-02-06 04:20:21
【问题描述】:
我尝试在 Ionic 5 项目中使用cordova-plugin-background-geolocation,在前台它工作正常,但在后台它不工作
ionic cordova plugin add "@mauron85/cordova-plugin-background-geolocation": "^3.1.0"
npm install "@ionic-native/background-geolocation": "^5.28.0"
下面的代码正在使用
let config: BackgroundGeolocationConfig = {
desiredAccuracy: 0,
stationaryRadius: 20,
distanceFilter: 10,
debug: false,
interval: 1000
};
this.backgroundGeolocation.configure(config).then((location) => {
// Run update inside of Angular's zone
// Calling Service to save coordinates
}, (err) => {
console.log(err);
});
// Turn ON the background-geolocation system.
this.backgroundGeolocation.start();
我该如何解决?
【问题讨论】:
标签: angular cordova ionic-framework geolocation ionic5