flutter_local_notifications icon indicating copy to clipboard operation
flutter_local_notifications copied to clipboard

[flutter_local_notifications] Schedule multiple notifications with different data

Open mojtabaghiasi opened this issue 4 years ago • 4 comments

flutter channel process cost in android can be high, so we can schedule multiple notifications with one channel method call. we can add a list of notification data including id, title, body, scheduled date, notification details, and more. with this method, w register all notifications just with one channel method call.

mojtabaghiasi avatar Oct 22 '21 19:10 mojtabaghiasi

@MaikuB Could you check this pull request?

mojtabaghiasi avatar Nov 01 '21 07:11 mojtabaghiasi

Will do but note that this was something requested before and I had decided not to have in the plugin to avoid bloating the core APIs. As there seems to be a bit more demand on this I may have to re-evaluate this (note: I haven't seen a great deal of posts about this though).

What kind of performance improvements are you experiencing now relative to scheduling them by iterating to make a schedule each notification? From what I saw, the Flutter team had been working on improving performance of using platform channels too

MaikuB avatar Nov 03 '21 11:11 MaikuB

@MaikuB When we want to schedule multi notifications (e.g 50 scheduled notifications), we should schedule by iterating to schedule each of them, when we use this method of scheduling multiple notifications, we can see UI lag and UI freeze on the main thread, I saw this problem many times. you can test this situation with some weak performance devices and observe this problem.

mojtabaghiasi avatar Nov 03 '21 12:11 mojtabaghiasi

I don't have access to such devices to check. What you're describing seems to be related to a general problem that can occur with Flutter applications and isn't specific to the plugin. There's an example shown here around how this can occur with parsing JSON and how it can be dealt with using isolates. I've heard from others in the community that they have been able to use isolates with this plugin for the scenario where multiple notifications need to be scheduled too. Given it's a general issue then a general solution would be better and be more scalable. Have you tried using this approach?

MaikuB avatar Nov 06 '21 08:11 MaikuB

I've tried running this in an isolate, but for some reason the UI still freezes

abdimussa87 avatar Dec 30 '23 20:12 abdimussa87

the same issue here

msxenon avatar Feb 13 '24 00:02 msxenon