Closed WingCH closed 3 months ago
@WingCH
Even if notification is dismissed, the foreground service does not stop immediately, but foreground service may become less importance.
This means that the service may experience delays or the Android OS may kill the service.
The best way in this situation is to use updateService
function when the onNotificationDismissed
event is fired.
@override
void onNotificationDismissed() {
print('onNotificationDismissed');
// Show notification again~
FlutterForegroundTask.updateService();
}
Thank you for your quick and detailed response.
I have another question: If I don't have a need to update the UI, and I do not include the following code:
FlutterForegroundTask.initCommunicationPort();
Will it affect the stability of the foreground service?
@WingCH
There is no need to initialize if there is no communication between main isolate(UI)
and background isolate(TaskHandler)
.
No impact to service :)
thanks~
https://developer.android.com/about/versions/14/behavior-changes-all#non-dismissable-notifications
I know that Android 14 allows users to turn off foreground service notifications.
Will dismissing the notification stop the foreground service from running?
Should I restart the foreground service when I receive
onNotificationDismissed
?