I'm building an ionic app with capacitor. I'm hoping that my app can perform background tasks after termination. If i'm reading the documentation correctly this should be possible by setting
stopOnTerminate: false
I've created a blank app that I can test the backgroundFetch plugin on and used the following code.
const config: BackgroundFetchConfig = {
stopOnTerminate: false, // Set true to cease background-fetch from operating after user "closes" the app. Defaults to true.
};
this.backgroundFetch.configure(config)
.then(() => {
console.log('Background Fetch initialized');
this.backgroundFetch.finish();
})
.catch(e => console.log('Error initializing background fetch', e));
this.backgroundFetch.start();
However when I build the app and open it with capacitor, I can see in the android studio logcat window that it has not updated the stopOnTerminate value
com.example.app D/TSBackgroundFetch: {
"taskId": "cordova-background-fetch",
"isFetchTask": true,
"minimumFetchInterval": 15,
"stopOnTerminate": true, // This should have changed to false
"requiredNetworkType": 0,
"requiresBatteryNotLow": false,
"requiresCharging": false,
"requiresDeviceIdle": false,
"requiresStorageNotLow": false,
"startOnBoot": false,
"forceAlarmManager": false,
"periodic": true,
"delay": -1
}
Is there something else I need to do to be able to change the defaults?