I am using cordova-plugin-background-mode plugin for Ionic app for running my app in background and perform some tasks.
I’ve achieved this on Android and its working good.
BUT on IOS I am unable to use background mode as it provides my app exactly 30sec of background running-time and kills the app after this. For this in case, I use cordova-plugin-background-fetch plugin.
The problem is it says
> Error initializing background fetch – “plugin_not_installed”
but ‘ionic plugin add’ says already installed…
My code:
const config: BackgroundFetchConfig = {
stopOnTerminate: false, // Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
};
backgroundFetch.configure(config)
.then(() => {
console.log('Background Fetch initialized');
this.backgroundFetch.finish();
})
.catch(e => console.log('Error initializing background fetch', e));