Reputation: 1337
Even though I followed the steps as per the official documentation, the background runner code does not work.
I added the plugin to my capacitor.config.json:
"BackgroundRunner": {
"label": "com.github.busaeed.myapp.runner",
"src": "assets/runner.js",
"event": "fetchNewData",
"repeat": true,
"interval": 15,
"autoStart": true
}
Here is the code of my src/assets/runner.js:
addEventListener('fetchNewData', (resolve, reject, args) => {
try {
console.log('received silent push notification');
CapacitorNotifications.schedule([
{
id: 100,
title: 'Enterprise Background Runner',
body: 'Received silent push notification',
},
]);
resolve();
} catch (err) {
reject();
}
});
Not even an error or warning message is displayed in the console which might help identify the issue.
Upvotes: 0
Views: 41