ios icon indicating copy to clipboard operation
ios copied to clipboard

scheduleLocalNotification fires immediately even though fireDate is of future

Open i1990jain opened this issue 4 years ago • 4 comments

I am creating a scheduleLocalNotification request, which I intend to fire after 7 days and repeat every week, in the following way but this notification is shown as soon as the code is executed, even though fireDate is of the future


`const request = {
        userInfo: { id: '1' },
        alertTitle: "TItle Text",
        alertBody: "body text.",
        fireDate: new Date(Date.now() + 604800000),
        repeatInterval: 'week',
      }

      PushNotificationIOS.scheduleLocalNotification(request);`

i1990jain avatar Jan 21 '21 20:01 i1990jain

Use PushNotificationIOS.addNotificationRequest(notification) instead of PushNotificationIOS.scheduleLocalNotification(request) since scheduleLocalNotification in deprecated. https://github.com/react-native-push-notification-ios/push-notification-ios#schedulelocalnotification

carbon

hassan-kiffgo avatar Feb 01 '21 07:02 hassan-kiffgo

Use PushNotificationIOS.addNotificationRequest(notification) instead of PushNotificationIOS.scheduleLocalNotification(request) since scheduleLocalNotification in deprecated. https://github.com/react-native-push-notification-ios/push-notification-ios#schedulelocalnotification

carbon

I updated to the latest version and addNotificationRequest does not fire at all if a fireDate is mentioned in the passed object. fires instantly when there is no fireDate object.

i1990jain avatar Feb 08 '21 15:02 i1990jain

Use PushNotificationIOS.addNotificationRequest(notification) instead of PushNotificationIOS.scheduleLocalNotification(request) since scheduleLocalNotification in deprecated. https://github.com/react-native-push-notification-ios/push-notification-ios#schedulelocalnotification carbon

I updated to the latest version and addNotificationRequest does not fire at all if a fireDate is mentioned in the passed object. fires instantly when there is no fireDate object.

same issue as this. addNotificationRequest does nothing if the fire date is in the future but works if I don't set a fireDate

isonlaxman avatar Mar 21 '21 02:03 isonlaxman

This might be helpful: https://github.com/react-native-push-notification-ios/push-notification-ios/issues/247

devinjameson avatar Mar 29 '21 05:03 devinjameson