initLocalNotification method

Future initLocalNotification()

Implementation

Future initLocalNotification() async
{
  logCat('NotificationController: ON initLocalNotification()');

  AndroidInitializationSettings initializationSettingsAndroid = const AndroidInitializationSettings('@mipmap/ic_launcher');
  DarwinInitializationSettings initializationIos = DarwinInitializationSettings(
    requestAlertPermission: true,
    requestBadgePermission: true,
    requestSoundPermission: true,
    //onDidReceiveLocalNotification: onDidReceiveLocalNotificationIos,
    // notificationCategories:[
    //   DarwinNotificationCategory(
    //     'demoCategory',
    //     actions: <DarwinNotificationAction>[
    //       DarwinNotificationAction.text('identifier', 'title', buttonTitle: '', )
    //       //DarwinNotificationAction('id_1', 'Action 1'),
    //
    //       // DarwinNotificationAction(
    //       //   'id_2',
    //       //   'Action 2',
    //       //   options: <DarwinNotificationActionOption>{
    //       //     DarwinNotificationActionOption.destructive,
    //       //   },
    //       // ),
    //
    //       // DarwinNotificationAction(
    //       //   'id_3',
    //       //   'Action 3',
    //       //   options: <DarwinNotificationActionOption>{
    //       //     DarwinNotificationActionOption.foreground,
    //       //   },
    //       // ),
    //     ],
    //     // options: <DarwinNotificationCategoryOption>{
    //     //   DarwinNotificationCategoryOption.hiddenPreviewShowTitle,
    //     // },
    //   )
    // ]
  );
  InitializationSettings initializationSettings = InitializationSettings(
    android: initializationSettingsAndroid,
    iOS: initializationIos,
    macOS: initializationIos,);

  await flutterLocalNotificationsPlugin.initialize(
    initializationSettings,
    onDidReceiveNotificationResponse: onDidReceiveNotificationResponse,
    onDidReceiveBackgroundNotificationResponse: onDidReceiveBackgroundNotificationResponse,
  );
  flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()?.requestNotificationsPermission;
  //NotificationHelper(flutterLocalNotificationsPlugin: flutterLocalNotificationsPlugin);
}