Using android service to start and stop ringtones#8
Open
aybefox wants to merge 7 commits into
Open
Conversation
Author
|
I just checked out: The service in this pull request is a background service. Maybe it's not enough to fix the second case... I will stay tuned. |
Author
|
Alarm sounds remain playing even if you close and reopen the app. You have to stop it explicitly by the given stop method. |
|
Have you tested this? Should I still use this Pull? |
sadrohan
approved these changes
Feb 3, 2021
sadrohan
approved these changes
Feb 3, 2021
|
This won't work if the asAlarm parameter set to true for the playNotification method case, please update that too. |
Member
|
@aybefox Can you rebase your changes to current HEAD? |
Closed
Closed
|
Any update on this? |
|
This pull request has stalled. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In two scenarios you are not able to stop alarm ringtones again with the current implementation:
In the first case, when you call FlutterRingtonePlayer#playAlarm from the callback a second instance of FlutterRingtonePlayerPlugin is running. Because the reference to ringtone is different (null) from the first (start) call the stop call won't work. I'm not sure why there are two instances running but I guess it relates to the fact that the callback will not run in the same isolate as the main app.
In the second case the reference just gets lost.
Anyway, in both cases the reason is that FlutterRingtonePlayerPlugin holds the ringtone reference in a transient way.
This is why I moved the start/stop code to a separate android service.