Closed rahulserver closed 4 years ago
Yes it's an issue, with ''enabled'' you should keep the notification in background
when you say But as soon as app exits
how do you exit ? pressing back or home ?
because if you press back, it close the app, so the notif too (it's related to the app' process, which is closes on back)
@florent37 pressing home does not dismiss the notification. But pressing back does.
Ideally I would expect the notification to stick there as a foreground service(as happens in other popular android apps). Doesn't Just having the notification when user is already running the app defeat the purpose of showing a notification?
I only implemented the foreground service, because a part of the library is implemented in flutter (ex: playlist, custom notif actions etc) flutter code can only be executed when the app is in foreground (or attached to a foreground service)
if you press home to "exit" the app, your player is not visible but you can continue using your app, it's the same no ?
I cannot because of technical stack (flutter) implement a background service that handle all the library
I only implemented the foreground service, because a part of the library is implemented in flutter (ex: playlist, custom notif actions etc) flutter code can only be executed when the app is in foreground (or attached to a foreground service)
if you press home to "exit" the app, your player is not visible but you can continue using your app, it's the same no ?
This is not the normal way people would exit the app. Pressing the back button is a more common way. I can't tell my users to use "Home" to exit the app.
It's an open source library, Feel free to fork it, try to implement a background service that handle all existing possibilities staying compatible with flutter & custom notif actions
I'll be happy to review it and merge it :)
but I don't think it's technically possible to do this
Probably this might be handled at application level using Isolate threads or something that allows the app to keep running despite the back button. I'd be glad to keep you updated if I find a solution.
This is the only audio plugin that I found working in whole of flutter packages. So thanks for the great work!
You'll have to update the flutter initialisation to not be attached to an activity but into the application
I don't know how it can be done but maybe it's possible :/
The audio is playing after closing the app, but the notification became hidden. Does the lib support showing notification when app is in the closed state? @florent37
Flutter Version
My version : Flutter 1.19.0-2.0.pre.173 • channel master • https://github.com/flutter/flutter.git
Lib Version
My version : assets_audio_player: ^1.6.3 assets_audio_player_web: ^1.6.3
Platform (Android / iOS / web) + version
Platform : Android
Describe the bug
I am playing audio using the plugin like this:
This causes the notification to be shown when app is running(even if screen closes). But as soon as app exits, the notification disappears. I am not sure if this is the intended behavior and is there a way to make the notification stay as a foreground service even if I exit the app(like google play music app).