使用Headless JS的React-Native本地通知

时间:2017-12-05 10:48:08

标签: android react-native notifications local headless

我正在尝试在本机中为本机发送本地通知。通过谷歌搜索我看到一种方法是使用无头JS,但有谁知道如何才能完全实现?我每天都需要在特定时间发送本地通知

1 个答案:

答案 0 :(得分:1)

您可以使用

来实现这一目标

https://github.com/zo0r/react-native-push-notification#scheduled-notifications

https://github.com/zo0r/react-native-push-notification#repeating-notifications

PushNotification.localNotificationSchedule({
  message: "My Notification Message", // (required)
  date: new Date(Date.now() + (60 * 1000)) // in 60 secs
});

修改1

PushNotification.localNotificationSchedule({
    message: "My Notification Message",
    date: new Date(fireDate),
    repeatType: 'time',
    repeatTime: 3600000
  });