periodicallyShow method

int periodicallyShow(
  1. RepeatInterval? repeatInterval, {
  2. int? id,
  3. String? title,
  4. String? body,
  5. String? payload,
  6. bool? androidAllowWhileIdle,
  7. String? icon,
  8. Importance? importance,
  9. Priority? priority,
  10. StyleInformation? styleInformation,
  11. bool? playSound,
  12. AndroidNotificationSound? sound,
  13. bool? enableVibration,
  14. List<int>? vibrationPattern,
  15. String? groupKey,
  16. bool? setAsGroupSummary,
  17. GroupAlertBehavior? groupAlertBehavior,
  18. bool? autoCancel,
  19. bool? ongoing,
  20. Color? color,
  21. AndroidBitmap<Object>? largeIcon,
  22. bool? onlyAlertOnce,
  23. bool? showWhen,
  24. int? when,
  25. bool? usesChronometer,
  26. bool? channelShowBadge,
  27. bool? showProgress,
  28. int? maxProgress,
  29. int? progress,
  30. bool? indeterminate,
  31. AndroidNotificationChannelAction? channelAction,
  32. bool? enableLights,
  33. Color? ledColor,
  34. int? ledOnMs,
  35. int? ledOffMs,
  36. String? ticker,
  37. NotificationVisibility? visibility,
  38. int? timeoutAfter,
  39. String? category,
  40. bool? fullScreenIntent,
  41. String? shortcutId,
  42. Int32List? additionalFlags,
  43. String? subText,
  44. String? tag,
  45. bool? presentAlert,
  46. bool? presentSound,
  47. bool? presentBadge,
  48. String? soundFile,
  49. int? badgeNumber,
  50. List<IOSNotificationAttachment>? attachments,
  51. List<MacOSNotificationAttachment>? macAttachments,
  52. String? subtitle,
  53. String? threadIdentifier,
})

Show a Notification periodically.

Implementation

int periodicallyShow(
  RepeatInterval? repeatInterval, {
  int? id,
  String? title,
  String? body,
  String? payload,
  bool? androidAllowWhileIdle,
  String? icon,
  Importance? importance,
  Priority? priority,
  StyleInformation? styleInformation,
  bool? playSound,
  AndroidNotificationSound? sound,
  bool? enableVibration,
  List<int>? vibrationPattern,
  String? groupKey,
  bool? setAsGroupSummary,
  GroupAlertBehavior? groupAlertBehavior,
  bool? autoCancel,
  bool? ongoing,
  Color? color,
  AndroidBitmap<Object>? largeIcon,
  bool? onlyAlertOnce,
  bool? showWhen,
  int? when,
  bool? usesChronometer,
  bool? channelShowBadge,
  bool? showProgress,
  int? maxProgress,
  int? progress,
  bool? indeterminate,
  AndroidNotificationChannelAction? channelAction,
  bool? enableLights,
  Color? ledColor,
  int? ledOnMs,
  int? ledOffMs,
  String? ticker,
  NotificationVisibility? visibility,
  int? timeoutAfter,
  String? category,
  bool? fullScreenIntent,
  String? shortcutId,
  Int32List? additionalFlags,
  String? subText,
  String? tag,
  bool? presentAlert,
  bool? presentSound,
  bool? presentBadge,
  String? soundFile,
  int? badgeNumber,
  List<IOSNotificationAttachment>? attachments,
  List<MacOSNotificationAttachment>? macAttachments,
  String? subtitle,
  String? threadIdentifier,
}) {
  repeatInterval ??= _repeatInterval;

  if (repeatInterval == null) {
    return -1;
  }

  //
  final notificationSpecifics = _notificationDetails(
    title,
    body,
    payload,
    androidAllowWhileIdle,
    icon,
    importance,
    priority,
    styleInformation,
    playSound,
    sound,
    enableVibration,
    vibrationPattern,
    groupKey,
    setAsGroupSummary,
    groupAlertBehavior,
    autoCancel,
    ongoing,
    color,
    largeIcon,
    onlyAlertOnce,
    showWhen,
    when,
    usesChronometer,
    channelShowBadge,
    showProgress,
    maxProgress,
    progress,
    indeterminate,
    channelAction,
    enableLights,
    ledColor,
    ledOnMs,
    ledOffMs,
    ticker,
    visibility,
    timeoutAfter,
    category,
    fullScreenIntent,
    shortcutId,
    additionalFlags,
    subText,
    tag,
    presentAlert,
    presentSound,
    presentBadge,
    soundFile,
    badgeNumber,
    attachments,
    macAttachments,
    subtitle,
    threadIdentifier,
  );

  if (notificationSpecifics == null) {
    id = -1;
  } else {
    //
    try {
      //
      if (id == null || id < 0) {
        id = Random().nextInt(999);
      }

      _flutterLocalNotificationsPlugin!.periodicallyShow(
        id,
        title,
        body,
        repeatInterval,
        notificationSpecifics,
        payload: payload,
        androidAllowWhileIdle: androidAllowWhileIdle!,
      );
    } catch (ex) {
      id = -1;
      getError(ex);
    }
  }
  return id;
}