gdelataillade / alarm

A Flutter plugin to easily manage alarms on iOS and Android
https://pub.dev/packages/alarm
MIT License
132 stars 86 forks source link

No alarm-audio is played #82

Closed maxx-st closed 1 year ago

maxx-st commented 1 year ago

Alarm plugin version 1.2.2

Describe the bug When an alarm is scheduled in >3min and the phone is then locked, no audio is playing when the alarm fires. Only the notification is shown, but the phone is not waking up and the audio is not playing. The volume was set to 50%. This only happens when locking the phone. leaving it unlocked does not trigger the bug (working as expected). This issue was found in a custom app implementing this package and was then tested in the example app with the same result.

To Reproduce For reproduction the example-app was used:

  1. Schedule alarm in 5min
  2. Put application in background by pressing home-button
  3. Lock phone (Necessary for bug)
  4. Wait until notification is shown but no audio is playing

Expected behavior Three things expected:

Device info Samsung S10e, Android 12

Additional context May be related to issue #80 but wanted to open a new one because this is related to the audio, not the notification

maxx-st commented 1 year ago

Found the solution: The problem comes from the battery optimization. If it's disabled, the alarms fire as expected.

More information can be found on DontKillMyApp under battery optimization.

By using e.g. disable_battery_optimization, the settings can be corrected