私は、毎朝午前8時に20分に起きてユーザーのジオロケーションに基づいてユーザーリマインダーを送信する必要があるIONIC2アプリを持っています。バックグラウンドジオロケーションを使用していてもしばらくしてからIONIC2 - アプリケーションが終了する
私は(ユーザの位置の変化を監視するためにIOSの重要な変更のAPIを使用しています)このプラグインを使用しています https://github.com/mauron85/cordova-plugin-background-geolocation
問題: 私はアプリや背景を閉じたときにアプリが殺されません。地理位置は私のためにしばらくの間働く。私は1時間までテストしました。しかし、私が翌朝目を覚ますと、IOSによってアプリが殺されたことがわかります。
アプリをバックグラウンドで実行し続ける別のプラグインがあることは知っていますが、私はAppStoreによってあなたのアプリが拒否されるという人からの苦情をたくさん読んでいます(実際にはプラグインに免責事項があります同様の効果もあります)。明日アプリを覚ますために
、私は単にここでのsetTimeout
setTimeout(function(){
console.log('waking up');
self.helper.scheduleLocalNotification('Hello World', 'Good Morning', 10, "");
self.ionViewDidEnter();
}, wakeupinMilliSeconds);
を設定し、私のジオロケーションコードです:
setupBackGroundGeolocation(){
let config = {
desiredAccuracy: 100,
stationaryRadius: 50,
distanceFilter: 100,
interval: 5000,
pauseLocationUpdates: false,
debug: false, // enable this hear sounds for background-geolocation life-cycle.
stopOnTerminate: false, // enable this to clear background location settings when the app terminates
};
BackgroundGeolocation.configure((location) => {
console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
this.currentLocation.lat = location.latitude;
this.currentLocation.lng = location.longitude;
Promise.all([
//I do some calculations here.
]).then(d => {
// IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
// and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
// IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
BackgroundGeolocation.finish(); // FOR IOS ONLY
});
}, (error) => {
console.log('BackgroundGeolocation error');
}, config);
// Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
BackgroundGeolocation.start();
}
どのようなgeolocationプラグインをexaclyで使用していますか? –