React native React Native中的计划本地通知
我正在尝试发出计划的本地通知,以提醒用户即使在用户未使用应用程序时也要执行某些操作。我想在React原生应用程序中执行此操作 我检查了此处提供的答案,但这些答案使用的是Expo CLI而不是React Native CLI。 还有一些软件包,比如Github上的“react native notifications”和“react native push notifications”,但我无法从中得到结果。检查这里和这里 我应该如何发布计划的本地通知React native React Native中的计划本地通知,react-native,React Native,我正在尝试发出计划的本地通知,以提醒用户即使在用户未使用应用程序时也要执行某些操作。我想在React原生应用程序中执行此操作 我检查了此处提供的答案,但这些答案使用的是Expo CLI而不是React Native CLI。 还有一些软件包,比如Github上的“react native notifications”和“react native push notifications”,但我无法从中得到结果。检查这里和这里 我应该如何发布计划的本地通知 NotificationsAndroid.l
NotificationsAndroid.localNotification({
title: "Local notification",
body: "This notification was generated by the app!",
extra: "data"
});
您可以使用:
从“反应本机推送通知”导入推送通知
PushNotification.localNotificationSchedule({
消息:“通知消息”,
日期:新日期(date.now()+60*1000),//60秒后
}); 您可以在特定时间使用react本机推送通知
let now = new Date();
now.setDate(now.getDate())
now.setHours(15);
now.setMinutes(58);
now.setMilliseconds(0);
PushNotification.localNotificationSchedule({
//... You can use all the options from localNotifications
message: "My Notification Message", // (required)
repeatType: 'day',
date: new Date(now),
allowWhileIdle: true, // (optional) set notification to work while on doze
});
您是否在完整的设置下正确地尝试了该软件包?您好,错误如下: