I have an app that, using WebRTC, is able to successfully connect and hold a video call. The actual call logic while the app is open is a separate concern but what I was looking for, is the classic "Press Home key and app backgrounds itself", only to be seen in a persistent notification with mute/hangup controls and details about the call.
Now Meet, Whatsapp all implement this, the UI is so similar that I'm convinced they're using the same API/Framework internally, likely something to do with the OS' telephony system integration (ConnectionService/CallKit all that).
I started out with awesome_notifications
, seemed simple enough to implement, actually showed a notification, but for some reason it would pop up on the screen and with one swipe it would go away not just from the screen but also from the notification panel, also it wasn't obeying the decorations/color/button icons
I then tried flutter_foreground_task
, which showed a notification without a pop, just stayed cleanly in the panel but again, was very easily dismissible.
AI claimed there is in fact a single cross-platform solution, claiming it to be the webtrit_callkeep
(implemented via the flutter_callkeep
package)
The idea was that it integrates and starts a call with the native telephony system itself from the OS, so a default sticky notification should show up, just like any call has (and they're pretty un-dismissible) so seemed to align with what I was shooting for.
However that ended up not showing any notifications at all, I tried to use a combo with foreground_task to manage a notification alongside and that's when the notification from that package stopped showing as well.
How can I show a persistent notification for my call with hangup/mute icons on the notification (which I could hook up to my internal methods)?
I know for a fact something like this exists because my native calls, Meet, and WhatsApp all share the exact same notification template.
I did mention all the services for packages (not all at once, only the one(s) I was using) in my AndroidManifest.xml
I did try my best to ensure the kinks of each plugin were met (foreground_task required wrapping its widget around MaterialApp, awesome_notif required initialization before runApp())
I made sure all the necessary perms were granted, and kept track of Android Version kinks regarding these.
Is there a blank project that does nothing but show a persistent notification if that's the way to go, I just want to know how it's implemented as I found no references/"official way" online.
The flutter_callkit_incoming package does exactly this. For my purposes I needed to have the mic functioning in the background as well
so I had to fork and add microphone
as a category alongside phoneCall
in the manifest service declaration and all worked like a charm