-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues regarding Actions #1786
Comments
You aren't meant to use the callbacks for when the app is killed. There's a method specific to scenarios when a notification launches an app https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications#getting-details-on-if-the-app-was-launched-via-a-notification-created-by-this-plugin. This would've shown in the example app too so you may need to spend a bit more time cross-referencing it in case there are scenarios that you've missed |
I did manage to get it work with help off On app initiation I open up a channel with ReceivePort: final receivePort = ReceivePort();
IsolateNameServer.registerPortWithName(receivePort.sendPort, _backgroundChannelKey);
backgroundMessagePort = receivePort.asBroadcastStream(); And on onDidReceiveBackgroundNotificationResponse function I send it by using: final sendPort = IsolateNameServer.lookupPortByName(_backgroundChannelKey);
sendPort?.send(notificationResponse); And then from UI part I just listen to backgroundMessagePort and react according to pressed notification action. About So basically the last issue is the 3rd point, but it's minor to me, as the functionality will work as expected in release version. So I'm closing this issue. Thank you @MaikuB for help! |
Describe the bug
The issue was detected during #1773 issue resolving. Main goal I want to achieve is that when App is terminated on Action press it will do some action. If App is open or hidden it will on Action execute so function but also update UI.
Test results
Opens App but doesn't fire anything after
Here are some issues regarding to test results:
While
showsUserInterface: false
does work fine, I can't to find a way how to update UI if App is open or hidden. It makes sense as it's running on separate isolate. And so far I don't how or is it possible to connect background isolate with UI. Maybe with flutter_isolate it is possible, but so far I haven't used isolates in direct way.When
showsUserInterface: true
, App seems to work fine if App is Open or Hidden, but it's Terminated while it does launch App on click it doesn't seem to do anything after launch. awesome_notifications seems to store events to fired but I don't know if this strategy is applicable here.During Tests I found that after running App for first time on Debug and Terminating App active notification just disappears and doesn't work. I does work if I open App from Terminated state, but seems weird why this is the case. On Profile mode it seems to work all fine. I don't know is that a known issue.
I tried to be as clear as possible. And below dropped the minimal example on closer to my use case where I try to emulate timer.
// chronometerCountDown: true, // not yet merged is my added code to implement https://developer.android.com/reference/android/app/Notification.Builder#setChronometerCountDown(boolean), but it shouldn't differ so much from current plugin version. Implementation is given in #1778
Sample code to reproduce the problem
The text was updated successfully, but these errors were encountered: