Comments (24)
I have the same problem as many here: want to place a weekly notification on a certain time of the day. Anybody knows what the parameter count
is for? What happens if you combine every
and on
?
There is a huge lack of documentation here.
from capacitor-plugins.
Hi. You can already do that with on
.
"remind every day on 08:00 am"
schedule: {
on: {
hour: 8,
minute: 0
}
}
"remind every day on 11:00 am"
schedule: {
on: {
hour: 11,
minute: 0
}
}
"remind every month on the 17th on 7:00 am"
schedule: {
on: {
day: 17
hour: 7,
minute: 0
}
}
from capacitor-plugins.
I think this an important feature for notifications, this issue is also the same as #2752
from capacitor-plugins.
Is it possible you look into this? I am fairly certain it would be easy on the android side at least.
Just make it possible to combine at
with every
or on
.
The current interval for repeating notifications using at
does not make any sense https://github.com/ionic-team/capacitor-plugins/blob/main/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationManager.java#L348
I would suggest to just use the at parameter as a startTime
for the repeating alarm when every
or on
is set.
https://github.com/ionic-team/capacitor-plugins/blob/main/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationManager.java#L365
https://github.com/ionic-team/capacitor-plugins/blob/main/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationManager.java#L374
For iOS we would have to do something similar.
Any reason against this?
from capacitor-plugins.
bumping this up. As users of ionic, we would like to be able to setup a daily notification at a specific time. (and a weekly one on a specific day and specific time)
does not seem to support that functionality.
If we use "every": day", we can't specify the start time. (kinda important, don't you think?) source code does this: long startTime = new Date().getTime() + everyInterval; should be long startTime = schedule.getAt() // but if there's an at specified, we don't get this far in the code.
if we use "on:" new Date(year, month, day, hour, minute, second) and "repeat", it repeats once a year. (or can we use count 365?)
The original poster covered it pretty clearly. We spent 2 days on this before digging into the source code.
I have the same issue as many others here: I want to build a daily notification on which time is selected in frontend and want to execute a daily notification at the same time every day. I tried the repeats: true and every: 'day' here, but it didn't work for me. I tried this and searched everywhere.
I'm Using Ionic with angular on that am Using the Local Notification capacitor plugin.
Look for my code below.
import { LocalNotifications } from '@capacitor/local-notifications';
async setAlarm() {
const now = new Date();
const alarmDate = new Date(this.alarmTime);
const alarmTime = new Date();
alarmDate.setFullYear(now.getFullYear(), now.getMonth(), now.getDate());
if (alarmDate <= now) {
alarmDate.setDate(alarmDate.getDate() + 1);
}
await LocalNotifications.schedule({
notifications: [
{
title: 'Alarm',
body: 'Time to wake up!',
id: 1,
schedule: {
at: new Date(this.alarmTime),
repeats: true,
every: 'day',
},
actionTypeId: '',
extra: null,
},
],
});
alert('Alarm set for ' + alarmDate.toLocaleTimeString() + '.');
}
from capacitor-plugins.
Daily Notifications should work. In my app the user can set a weekday and a time when notification should be sent, e.g.
import { LocalNotificationSchema, LocalNotifications, Weekday } from '@capacitor/local-notifications';
const notifyAt = new Date();
const notifications: LocalNotificationSchema = [
Weekday.Monday,
Weekday.Tuesday,
Weekday.Wednesday,
Weekday.Thursday,
Weekday.Friday,
Weekday.Saturday,
Weekday.Sunday,
]
.map(weekday => {
return {
title: 'some title',
body: 'some body',
id: weekday,
schedule: {
on: {
weekday,
minute: notifyAt.getMinutes(),
second: 0,
hour: notifyAt.getHours(),
},
},
};
});
await LocalNotifications.schedule({ notifications })
from capacitor-plugins.
The documentation for this (V3) is extremely lacking. Please can someone update it to provide a way to:
- Schedule a DAILY notification at a specific time, e.g. Every DAY at 15:00
- Schedule a WEEKLY notification at a specific time, e.g. Every WEEK at 15:00
- Schedule a SPECIFIC DAY OF THE WEEK notification at a specific time, e.g. Every WEDNESDAY at 15:00
This is what we are trying to work out. The silence from the team is extremely frustrating. We want to use the Capacitor plugins, but if they aren't properly documented, how are we supposed to use and trust them over old Cordova ones?
Thanks.
from capacitor-plugins.
+1 - I have been struggling with this issue for days. I can't find any relevant information on how to do this. I see a lot of different questions and issue about this, but no feedback from the core team?
the documentation says it's possible, but from what I can tell it dose not seem to be the case for daily or weekly reminders.
I've only tested this on Android (7, 9, 11) - but feel free to do what I did here, it's a workaround, but it works in my testing so far:
https://www.codingandclimbing.co.uk/blog/android-localnotifications-with-cordova-capacitor-example
from capacitor-plugins.
@ionicsiva we had the exact same issue on our end. I really hope this is something the Capacitor team will prioritise.
After spending days trying to solve this and even play around with source code, we decided to go with a backend implementation and OneSignal for all of our notifications. But with that said, the local notification should something that is a core part of Capacitor.
from capacitor-plugins.
Daily Notifications should work. In my app the user can set a weekday and a time when notification should be sent, e.g.
import { LocalNotificationSchema, LocalNotifications, Weekday } from '@capacitor/local-notifications'; const notifyAt = new Date(); const notifications: LocalNotificationSchema = [ Weekday.Monday, Weekday.Tuesday, Weekday.Wednesday, Weekday.Thursday, Weekday.Friday, Weekday.Saturday, Weekday.Sunday, ] .map(weekday => { return { title: 'some title', body: 'some body', id: weekday, schedule: { on: { weekday, minute: notifyAt.getMinutes(), second: 0, hour: notifyAt.getHours(), }, }, }; }); await LocalNotifications.schedule({ notifications })
Thank you for your assistance; it's working. Sending love from India!👍❤️
from capacitor-plugins.
Hi, I got the same issue here. Daily reminders at a specific time would be awesome!
from capacitor-plugins.
@ralscha Ah, thanks! Going to try that out :)
from capacitor-plugins.
I have a similar problem. The documentation is unfortunately insufficient. I would like to send notifications every Monday at 20:00, is that possible?
from capacitor-plugins.
@jannnnnn Don't see a way to do that with the current implementation. A startTime
for every
would solve that. Or if on
would support a day of week
property, like cron.
from capacitor-plugins.
@ralscha I went through the source code and come to the same conclusion. I have now switched back to the cordova plugin https://github.com/katzer/cordova-plugin-local-notifications
from capacitor-plugins.
Looking for the ability to schedule a notification on a specific day of the week every week like @jannnnnn mentioned. Any other thoughts on how to achieve this?
from capacitor-plugins.
@ralscha I went through the source code and come to the same conclusion. I have now switched back to the cordova plugin https://github.com/katzer/cordova-plugin-local-notifications
I have used this plugin for long. Is very buggy, not reliable, be careful and make a lot of test.
from capacitor-plugins.
Bump
from capacitor-plugins.
+1 - I have been struggling with this issue for days. I can't find any relevant information on how to do this. I see a lot of different questions and issue about this, but no feedback from the core team?
the documentation says it's possible, but from what I can tell it dose not seem to be the case for daily or weekly reminders.
from capacitor-plugins.
+1 - I have been struggling with this issue for days. I can't find any relevant information on how to do this. I see a lot of different questions and issue about this, but no feedback from the core team?
the documentation says it's possible, but from what I can tell it dose not seem to be the case for daily or weekly reminders.I've only tested this on Android (7, 9, 11) - but feel free to do what I did here, it's a workaround, but it works in my testing so far:
https://www.codingandclimbing.co.uk/blog/android-localnotifications-with-cordova-capacitor-example
@daveshirman amazing job with that blog post! Maybe just mention that it only seems to work with the 0.9.0-beta.3
cordova plugin. Looks like npm
is installing the 0.9.0-beta.2
version. I'll do some more testing on both Android and iOS tomorrow to see if it helps with the daily reminders.
With that said, I still hope to see some clarification around the daily reminders from the Ionic team on the @capacitor/local-notifications
plugin 🙏
from capacitor-plugins.
+1 - I have been struggling with this issue for days. I can't find any relevant information on how to do this. I see a lot of different questions and issue about this, but no feedback from the core team?
the documentation says it's possible, but from what I can tell it dose not seem to be the case for daily or weekly reminders.I've only tested this on Android (7, 9, 11) - but feel free to do what I did here, it's a workaround, but it works in my testing so far:
https://www.codingandclimbing.co.uk/blog/android-localnotifications-with-cordova-capacitor-example@daveshirman amazing job with that blog post! Maybe just mention that it only seems to work with the
0.9.0-beta.3
cordova plugin. Looks likenpm
is installing the0.9.0-beta.2
version. I'll do some more testing on both Android and iOS tomorrow to see if it helps with the daily reminders.With that said, I still hope to see some clarification around the daily reminders from the Ionic team on the
@capacitor/local-notifications
plugin 🙏
Have updated my post to reference exact plugin url I used, hint it's not the katzer one that appears everywhere:
npm install https://github.com/Steffaan/cordova-plugin-local-notifications.git;
EDIT: The notification didn't trigger for the consecutive days, so I've updated my post with count
in the trigger, i.e:
trigger: { every: { hour: hours, minute: mins }, count: 365 },
Manually changing the date + time seems to trigger it, but will do more testing letting the phone do its thing over the next few days.
Any other info your side?
from capacitor-plugins.
bumping this up. As users of ionic, we would like to be able to setup a daily notification at a specific time. (and a weekly one on a specific day and specific time)
does not seem to support that functionality.
If we use "every": day", we can't specify the start time. (kinda important, don't you think?)
source code does this: long startTime = new Date().getTime() + everyInterval;
should be long startTime = schedule.getAt() // but if there's an at specified, we don't get this far in the code.
if we use "on:" new Date(year, month, day, hour, minute, second) and "repeat", it repeats once a year. (or can we use count 365?)
The original poster covered it pretty clearly. We spent 2 days on this before digging into the source code.
from capacitor-plugins.
Would love to see this supported!
from capacitor-plugins.
I was very surprised this was not supported. After digging a little deeper it seems unfortunately to be a limitation in iOS, though it seems possible on android. Please correct me if I'm wrong.
from capacitor-plugins.
Related Issues (20)
- Capacitor Splash Screen plugin is reporting crash error on crashlytics for android 11 kindle device HOT 2
- @capacitor/camera - Android "Selected Photos Access"
- FIX for Android API 34 support for Share plugin Capacitor 5
- feat: @capacitor/action-sheet - allow click-outside and back-button on ActionSheet on Android HOT 1
- @capacitor/splash-screen add "splashScreenHidden" event HOT 1
- @capacitor/browser detect url change with an event
- @capacitor/keyboard v6 stopped working for windowSoftInputMode="adjustPan" on older SDKs HOT 3
- @capacitor/google-maps: fail to re-create map on iOS
- Accessing a linux filesystem
- "App" plugin is not implemented on ios
- @capacitor/geolocation sometimes not working HOT 1
- Capacitor Keyboard height incorrect in Capacitor 6 HOT 4
- Haptics (5.0.7) vibrate call throws error in Firefox desktop HOT 1
- @capacitor/app-launcher canOpenUrl crashed app (android) HOT 1
- [@capacitor/local-notifications] - iOS and Android - No notification received when the setting manually changed. HOT 2
- When using the @capacitor/camera plugin, the system image picker menu displays incorrectly on Android devices in landscape mode. HOT 1
- [@capacitor/local-notifications] - Android - Schedule Notification not sending on first occurrence. HOT 2
- Dismiss Keyboard Prevented on iOS HOT 1
- [@capacitor/camera] - Android - RuntimeException: java.lang.reflect.InvocationTargetException
- @capacitor/camera: Photo Picker from Gallery not working in VM_Ware(Airwatch) MDM. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capacitor-plugins.