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

Make NotificationSettings Optional to Support Custom Local Notifications #284

Closed kangmyonggyu closed 1 week ago

kangmyonggyu commented 1 week ago

Hello, and thank you for your great work on this project!

I'm working on an app that uses custom local notifications to alert users of specific events. However, NotificationSettings is currently mandatory, which creates conflicts when displaying customized local notifications, especially when receiving alarm notifications.

If possible, could NotificationSettings be made optional? This would allow developers to set it as null when it's not needed, preventing conflicts with custom local notifications.

Additionally, on iOS 18.0.1 with alarm version ^4.0.10, notifications configured through NotificationSettings are not being received in background mode. Considering this, making NotificationSettings optional would greatly help in achieving sync between iOS and Android.

Thank you very much for considering this enhancement. I believe it would help make the app experience smoother for both developers and users.

gdelataillade commented 1 week ago

Hi @kangmyonggyu

Thank you for your interest in the plugin.

Regarding iOS notifications, you can disable them by setting both the title and body parameters to empty strings.

As for Android, it is unfortunately mandatory to display a notification. This is because the plugin relies on a foreground service to trigger alarms in the background. According to Android’s regulations, any foreground service must be linked to an active notification. This requirement ensures that users are aware of services running in the background, providing transparency and enhancing user control over their device’s activities.

I hope this clarifies the reasoning behind this functionality. If you have further questions, please let me know!