-
Notifications
You must be signed in to change notification settings - Fork 273
Open
Labels
Keep Openthis label avoids the stale botthis label avoids the stale bot
Description
Have tried about just about every config concievable to get the foreground service running but it just won't continue executing as soon as I dismiss the parent app to the background.
await notifee.registerForegroundService((notification: Notification) => {
return new Promise(resolve => {
const interval2 = setInterval(() => console.log('testmessage'), 6000);
notifee.onBackgroundEvent(async event => {
if (event.type === EventType.DISMISSED) {
await notifee.cancelNotification(notification.id || '');
console.log('Handled DISMISSED onBackgroundEvent');
}
return resolve();
});
notifee.onForegroundEvent(async event => {
if (event.type === EventType.DISMISSED) {
await notifee.cancelNotification(notification.id || '');
}
return resolve();
});
});
});
```
The above 'test message' will continue displaying every 6 s as long as the app is on the foreground but as soon as I return to main screen that execution freezes (i.e. it's not properly attached to the foreground service). When I open the app again, it may unfreeze.
The testmessage code is meant to actually be a 'refreshNotification' type of function, but it never worked therefore I'm attaching this simplified example.
Android logs keep spamming
`08-08 10:55:06.711 583 818 W IPCThreadState: Sending oneway calls to frozen process.`
Which I think may be indicative of what the issue is, i.e. the setInterval function isn't properly attached to any process (foregroundProcess?) which is meant to stay alive when the app is in the background.
Similarly, functions like
await notifee.stopForegroundService();
await notifee.cancelAllNotifications();
seem to have no effect, i.e. even after I call them, the interval messages will keep executing if they'd been started like above.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Keep Openthis label avoids the stale botthis label avoids the stale bot