MaikuB / flutter_local_notifications

A Flutter plugin for displaying local notifications on Android, iOS, macOS and Linux
2.47k stars 1.4k forks source link

creating custom intervals for periodicallyShow causes app to crash #1132

Closed hariaditya97 closed 3 years ago

hariaditya97 commented 3 years ago

I am looking to create custom repeat intervals for notifications - such as once every two days, once a month or even once every two weeks. In order to define a custom interval - such as once every two weeks - I simply modified the static value of calculateRepeatIntervalMilliseconds() function.

I changed the repeat interval for weeklyNotifications to 60000 60 24 7 2. However, when I set a notification (which is supposed to occur once every two weeks, the app crashes). I am currently using the plugin on my own app.

I understand why a monthly reminder option doesn't exist for the plugin, since monthly repeat could vary depending upon the user, however, if I utilize the Calendar object in java and create my own formula, which adds the required number of days to the repeat interval, such as 28, 29 or 30 depending upon the current month and other parameters, would this work? I am looking to implement an option for fortnightly notification and a monthly repeating one. Will simply modifying the repeatInterval parameter work? As of now, it's causing the app to crash.

Thank You

MaikuB commented 3 years ago

I won't be able to provide much help on this. As you're doing your own customisations, you'd need to look into crashes yourself. If there are crashes with the original plugin and steps to reproduce etc then I can investigate those.

Regarding your other idea. I'd suggest asking on an Android dev forum or Stack Overflow. I don't have much knowledge about using the Android APIs via code and I only learnt what was required for developing the plugin. Note that using elapsed time won't cater for locations that deal with daylight savings.

If you're going to support iOS as well, then you should assess the APIs if it supports what you need as well. Otherwise you could try to do something on Android only to find it can't be done on iOS.

I'll be closing this issue as there's no bug with the original plugin code being reported here