Closed dtkdt100 closed 1 year ago
Hi @dtkdt100,
Thanks for your interest in the plugin.
I must use AndroidAlarmManager.oneShotAt
because if I don't, the alarm won't ring if the app is in background. This method creates an isolate to ensure that the code in playAlarm
is executed whether app is in foreground or background.
Furthermore, I'm not sure that's the reason of the delay. I think a reason that could explain the delay is if the audio asset is large, because the player has to load it before being able to play it.
Do you have this issue with the example app ? If not, is your audio asset large ?
Hi, @gdelataillade . Thank you so much for replaying so fast!
The whole point of my issue that you don't need to use background alarm, because the datetime is so close (I mean in a metter of milliscronds to one second). Checkout my fork https://github.com/Dolev-Franco/alarm It is working good (you just need to add a if statement - if date is close
).
My asset is not to large, I know it because in my fork it working well.
Hi @dtkdt100
OK I understand your request. I'll add it to the plugin as soon as I find the time. I'll let you know when it's done.
@gdelataillade I am going to make a PR for this
@gdelataillade
Alarm plugin version latest
Describe the bug Alarm sound is playing in delay of 5 seconds. I am setting an alarm for DateTime.now() and only after 3 seconds the alarm rings
To Reproduce Steps to reproduce the behavior:
Expected behavior The alarm needs to go off in the same time it setts. Maybe 1 second delay
What I would do is putting
if (dateTime is close to the time now)
inandroid alarm
.dart, so play alarm and not callAndroidAlarmManager.oneShotAt
Screenshots
Device info Pixel 6, android 13