Closed luiseduardobrito closed 4 months ago
Hm. I'm afraid I really don't know - I've never worked with background services. If they use isolates - and they probably do - then I think the answer may be 'no': anything other than the main thread has little support for many of the standard system libraries.
I think my advice would be to rip out the iOS and Android parts of NowPlaying, and connect with them directly via a method service inside your background service.
Cheers!
Hey, just a heads up. I made it work on background by embedding the logic of this package into flutter_notification_listener fork of mine. It is only for Android though. On the app that I'm working on, we already use that package so it's been a cleaner solution for us instead of listening the notifications from two different points.
You can check my fork below. It provides both TrackInfo and NotificationEvent stream. So you can handle both media and normal notifications. https://github.com/AlpSha/flutter_notification_listener
Let me know if you get any issues. Thanks
(Sorry for late reply) Thanks! That's brilliant. I'll take a look.
Hello!, I'm trying to write an app that will store the listening history in my Android device, such as Last.fm.
Is it possiblie to use
nowplaying
within a background service, such as flutter_background_service ? I created a minimal test but I don't get notified by the stream when the player changes its state.