I am currently working on an ionic app with capacitor. My goal is to have my app execute background tasks even after it has been terminated. From what I've gathered in the documentation, this should be achievable by adjusting the following parameter:
stopOnTerminate: false
To test out the backgroundFetch plugin, I set up a basic app and implemented the code snippet below:
const config: BackgroundFetchConfig = {
stopOnTerminate: false, // Changing this to true would stop background-fetch when user exits the app.
};
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();
Despite these configurations, after building the app and checking the android studio logcat window via Capacitor, I noticed that the stopOnTerminate value did not reflect the change:
com.example.app D/TSBackgroundFetch: {
"taskId": "cordova-background-fetch",
"isFetchTask": true,
"minimumFetchInterval": 15,
"stopOnTerminate": true, // The intended result was for this to be set as false
"requiredNetworkType": 0,
"requiresBatteryNotLow": false,
"requiresCharging": false,
"requiresDeviceIdle": false,
"requiresStorageNotLow": false,
"startOnBoot": false,
"forceAlarmManager": false,
"periodic": true,
"delay": -1
}
Is there an additional step required to modify the default settings effectively?