I'm planning to develop simple audio player, but currently I'm stuck on notification support. I want notification that is persistent while audio is playing and I also need some controls (like play/pause, next/previous) and possibly fanart visible on notification. That's similar as most other player do (Aimp, Google Play Music etc).
I was looking forward for good example how to develop it using Dart/Flutter, well is that even possible without writing native code for each platform (Android/iOS)? Is there any plugin that supports that kind of notification on both platforms? Plus, of course, foreground service bound to it to don't kill audio playback when screen is off.
A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform.
Based on the publish/subscribe model, FCM topic messaging allows you to send a message to multiple devices that have opted in to a particular topic. You compose topic messages as needed, and FCM handles routing and delivering the message reliably to the right devices.
After the Initialization, the notification can be scheduled using zonedschedule() method. In that, we should give notification details like Title, description, etc. Android and iOS get their own notification details like android has channels, so we should give channel id, channel name, importance, priority, etc.
In the main app target, select Signing & Capabilities > All > + Capability and then search "push." Double-click on Push Notifications to enable it. Next, enable Background Modes and check Remote Notifications. Now you are ready to send notifications from the OneSignal dashboard!
You might be interested in looking at package:audio_service which seems like it might handle the majority of the work for you, including the handling of background execution and notifications.
Also, for notifications I've had success with package:flutter_local_notifications but you shouldn't need this if you're going to use package:audio_service
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With