invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.88k stars 228 forks source link

Unable to Schedule Daily Notifications #1014

Closed milankakadiya2001 closed 7 months ago

milankakadiya2001 commented 8 months ago

Hello,

I need assistance with a feature implementation.

I'm aiming to schedule daily notifications in my application. Specifically, if a user opens the application each day, a notification should be triggered at 11:00 AM. However, if a user fails to open the app, the notification should not be triggered.

I'd like to implement functionality where, if the user opens the app today but hasn't opened it for several consecutive days, the notification will be scheduled to occur at 11:00 AM for the next week or month.

Notification function

`export const scheduleNotification = async () => { const channelId = await notifee.createChannel({ id: '01', name: 'Reminder', sound: 'n0', importance: AndroidImportance.HIGH, });

const morning = new Date(); morning.setHours(11, 0, 0, 0); // Set time to 11:00 AM

const morningTrigger = { type: TriggerType.TIMESTAMP, timestamp: morning.getTime(), repeatFrequency: RepeatFrequency.DAILY, interval: 1, };

// Create morning notification await notifee.createTriggerNotification( { title: 'Test', body: 'Reminder: Tap here to start now.', ios: { sound: 'default', }, android: { channelId, groupId: 'group', category: AndroidCategory.REMINDER, importance: AndroidImportance.HIGH, visibility: AndroidVisibility.PUBLIC, localOnly: true, sound: 'default', vibrationPattern: [50, 250, 250, 50], pressAction: { id: 'default', launchActivity: 'default', }, showTimestamp: true, }, }, morningTrigger, ); };`

Your help in refining this functionality would be greatly appreciated. Thank you!

github-actions[bot] commented 7 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.