-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support setting a repeating notification in a custom hour and minute #31
Comments
I believe what you're asking for is duplicate of what was discussed in #25. I wasn't able to find a nice abstraction and way to implement it on all platforms (note: i have to consider the legacy iOS notification APIs as well). However, with regards to what you've suggested, I don't think it will work. I believe it's rather misleading as what you're after is for the notification to fire at a specific time but you've actually passed through a DateTime instance. IMO, it'd be more accurate to create a custom time class but then the issue would be how to implement on all platforms. The implementation for iOS side is bit more tricky, particularly for the newer user notifications framework. Currently the Doing it based on date time requires specifying to the framework the date/time components it should match on via this trigger. Doing a time based one on iOS means it'll always fire at the specified time and as far as i know, there seems to be no way to combine the time and interval with the newer framework. The older UILocalNotification framework allowed for doing this. I think the best that can done in terms of providing an abstraction for all platforms is have another method (i guess called something like showDailyAtTime(...)) that fires a notification daily at a specified time. Meaning there's no interval can be specified. Unfortunately, it's not something I can explore at the moment so I can focus on building my app(s), but you're welcome to submit a PR for me to review :) |
First of all, thanks for your response. In regards to your comment
What signature do you imagine for such method? I imagine something like this. class RepeatTime {
final int hours;
final int minutes;
RepeatTime(this.hours, this.minutes);
}
await flutterLocalNotificationsPlugin. showDailyAtTime(
ALARM_NOTIFICATION_ID,
ALARM_TITLE,
ALARM_BODY,
new RepeatTime(10, 0), // I could use two integers here
platformChannelSpecifics); If we can agree on this method interface I will contribute on the Java implementation. Objective C creeps me out a little bit, I'll try to do my best but I can't promise a nice and expressive Objective C implementation. |
That looks about right though I'd just rename the RepeatTime class to Time. Whilst I doubt anyone would really use the specify the seconds, it may be worth adding in that component for the sake of completion. Re: objective C, I get where you're coming as this project was first time actually writing in objective C :) |
Ok, I'll create the java version tonight, and see how much can I do in the Objective-C world. Probably I'll create a PR to discuss how I'm advancing. |
I've just created the PR for android. I'll try to make it work for IOS |
Closing as this is addressed in PR #33 |
I want to schedule a notification everyday at 10 AM. But currently I depend on the time that the notification is being setted up.
What I'm thinking is the following
What do you think?
Thanks
The text was updated successfully, but these errors were encountered: