【问题标题】:Repeating Notifications in React Native Push NotificationReact Native 推送通知中的重复通知
【发布时间】:2022-08-11 19:40:13
【问题描述】:

如何设置 react-native-push-notification 以在特定时间每天显示本地通知。

因此,在我的移动应用程序中,我有一个屏幕,您可以在应用程序中设置提醒,在选择下午 3:30 后,我想在每天下午 3.30 显示通知。

我尝试使用PushNotification.localNotificationSchedule,但它没有按预期工作。为了测试视角,假设我想在下午 3.30 显示第一个通知,并且每小时向用户显示相同的通知。

PushNotification.createChannel({
    channelId: \'reminders\', // (required)
    channelName: \'Task reminder notifications\', // (required)
    channelDescription: \'Reminder for any tasks\',
  },
  () => {},
);

PushNotification.localNotificationSchedule({
  channelId: \'reminders\',
  title: \'???? Reminder!\',
  message: \'You have set this reminder\',
  date,
  repeatType: \'hour\',
});

但不幸的是,通知仅在下午 3.30 显示,重复不起作用...

我正在考虑为全年创建一个时间戳数组并运行 localNotificationSchedule 365 次,但我认为这不是一个好主意......

你有什么建议应该如何在 iOS 和 android 中工作?

    标签: android ios react-native push-notification localnotification


    【解决方案1】:

    您是否尝试过重复类型:“天”? https://github.com/zo0r/react-native-push-notification

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-13
      • 1970-01-01
      • 2015-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多