Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 本地通知关闭工作计划通知重复频率_Flutter_Notifications_Localnotification_Time Frequency - Fatal编程技术网

Flutter 本地通知关闭工作计划通知重复频率

Flutter 本地通知关闭工作计划通知重复频率,flutter,notifications,localnotification,time-frequency,Flutter,Notifications,Localnotification,Time Frequency,当我尝试实现scheduledNotificationRepeatFrequency和set daily功能时,通知后的第二天不会出现?如何将每日通知设置为确定的小时和分钟? 这是我的代码: Future<void> _scheduleDailyNotification( int id, String title, int nday, int hour, int minute, ) async { int nhour = hour - TimeOfDa

当我尝试实现scheduledNotificationRepeatFrequency和set daily功能时,通知后的第二天不会出现?如何将每日通知设置为确定的小时和分钟? 这是我的代码:

Future<void> _scheduleDailyNotification(
  int id,
   String title,
   int nday,
  int hour,
  int minute,
  ) async {
  int nhour = hour - TimeOfDay.now().hour;
  int nminute = minute - TimeOfDay.now().minute;
  print(hour);
  print(nhour);
  print(nminute);
  var androidplatformchannelspecs = AndroidNotificationDetails(
  '1',
  'xClock title',
  'xClock description',
  channelAction: AndroidNotificationChannelAction.createIfNotExists,
  icon: 'ic_xclockicon',
  sound: RawResourceAndroidNotificationSound('ringstone'),
  largeIcon: DrawableResourceAndroidBitmap('ic_xclockicon'),
    );
  var iosplatformchannelspecs = IOSNotificationDetails(
    presentAlert: true,
    presentBadge: true,
    presentSound: true,
    sound: 'ringstone.wav');
  await flutterLocalNotificationsPlugin.zonedSchedule(
  id,
  title,
  'xClock è tempo di $title',
  _nextInstanceOfTenAM(nday, nhour, nminute),
  NotificationDetails(
      android: androidplatformchannelspecs,
      iOS: iosplatformchannelspecs,
      macOS: null),
  androidAllowWhileIdle: true,
  uiLocalNotificationDateInterpretation:
      UILocalNotificationDateInterpretation.absoluteTime,
  scheduledNotificationRepeatFrequency:
      ScheduledNotificationRepeatFrequency.daily);
 }


tz.TZDateTime _nextInstanceOfTenAM(int nday, int nhour, int nminute) {
final tz.TZDateTime now = tz.TZDateTime.now(tz.local);
tz.TZDateTime scheduledDate = tz.TZDateTime.now(tz.local)
  .add(Duration(days: nday, hours: nhour, minutes: nminute))
  .subtract(Duration(seconds: now.second));

if (scheduledDate.isBefore(now) || nday < 0) {
(scheduledDate.isBefore(now))
    ? scheduledDate = scheduledDate.add(const Duration(days: 7))
    : scheduledDate = scheduledDate.add(const Duration(days: 0));
 } else {}
 print('schedule');
 print(scheduledDate);
 return scheduledDate;
 }
Future\u计划每日通知(
int id,
字符串标题,
星期五,
整小时,
整数分钟,
)异步的{
int nhour=hour-TimeOfDay.now().hour;
int nminute=minute-TimeOfDay.now().minute;
打印(小时);
印刷(每小时);
打印(n分钟);
var androidplatformchannelspecs=AndroidNotificationDetails(
'1',
“xClock title”,
“xClock说明”,
channelAction:AndroidNotificationChannelAction.createIfNotExists,
图标:“ICxClockIcon”,
声音:RawResourceAndroidNotificationSound(“铃声”),
largeIcon:DrawableResourceAndroidBitmap('ic_xLockIcon'),
);
var iosplatformchannelspecs=IONotificationDetails(
主持人:是的,
presentBadge:正确,
当前声音:正确,
声音:“ringstone.wav”);
等待本地通知规划分区时间表(
身份证件
标题
“xClockètempo di$title”,
_下星期五(星期五、四、五分钟),
通知详情(
android:androidplatformchannelspecs,
iOS:iosplatformchannelspecs,
macOS:null),
安德罗德洛维希莱德:是的,
UILocalNotificationDate解释:
UILocalNotificationDateExpansion.absoluteTime,
ScheduledNotification重复频率:
计划通知重复频率(每天);
}
tz.TZDateTime(星期五、小时、分钟内){
final tz.TZDateTime now=tz.TZDateTime.now(tz.local);
tz.TZDateTime scheduledDate=tz.TZDateTime.now(tz.local)
.add(持续时间(天:星期二,小时:小时,分钟:分钟))
.减去(持续时间(秒:现在.秒));
if(scheduledDate.isBefore(now)| | nday<0){
(scheduledDate.isBefore(现在))
?scheduledDate=scheduledDate.add(持续时间(天:7))
:scheduledDate=scheduledDate.add(常量持续时间(天:0));
}else{}
打印(“附表”);
打印(时间表);
返回时间表;
}
我尝试使用flatterLocalNotificationsPlugin.PeriodicalyShow,但我只能选择daily、hourly、weekly、everyminute,但我还想选择此弹出窗口的时间