private static void InitPushNotifications(NSDictionary options) { FirebasePushNotificationManager.CurrentNotificationPresentationOption = UNNotificationPresentationOptions.Alert; var isRegistrationNeeded = string.IsNullOrEmpty(CrossFirebasePushNotification.Current.Token); var notificationContentUI = new NotificationContentUI(); FirebasePushNotificationManager.Initialize(options, new[] { new NotificationUserCategory("message_en", new List <NotificationUserAction> { new NotificationUserAction("details", notificationContentUI.TxtDetails.EnUsValue, NotificationActionType.Foreground), new NotificationUserAction("cancel", notificationContentUI.TxtMarkAsRead.EnUsValue, NotificationActionType.Destructive) }), new NotificationUserCategory("message_ru", new List <NotificationUserAction> { new NotificationUserAction("details", notificationContentUI.TxtDetails.RuRuValue, NotificationActionType.Foreground), new NotificationUserAction("cancel", notificationContentUI.TxtMarkAsRead.RuRuValue, NotificationActionType.Destructive) }) }, isRegistrationNeeded); CrossFirebasePushNotification.Current.OnNotificationOpened += App.OnNotificationOpened; CrossFirebasePushNotification.Current.OnNotificationAction += App.OnNotificationOpened; }
private void InitPushNotifications() { if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { FirebasePushNotificationManager.DefaultNotificationChannelId = "FirebasePushNotificationChannel"; FirebasePushNotificationManager.DefaultNotificationChannelName = "General"; } var notificationColor = ContextCompat.GetColor(this, Resource.Color.notification); FirebasePushNotificationManager.Color = new Color(notificationColor); FirebasePushNotificationManager.IconResource = Resource.Drawable.ic_notification; FirebasePushNotificationManager.Initialize(this, new PushNotificationHandler(), false, true, false); var notificationContentUI = new NotificationContentUI(); FirebasePushNotificationManager.RegisterUserNotificationCategories(new[] { new NotificationUserCategory("message_en", new List <NotificationUserAction> { new NotificationUserAction("details", notificationContentUI.TxtDetails.EnUsValue, NotificationActionType.Foreground), new NotificationUserAction("cancel", notificationContentUI.TxtMarkAsRead.EnUsValue) }), new NotificationUserCategory("message_ru", new List <NotificationUserAction> { new NotificationUserAction("details", notificationContentUI.TxtDetails.RuRuValue, NotificationActionType.Foreground), new NotificationUserAction("cancel", notificationContentUI.TxtMarkAsRead.RuRuValue) }) }); CrossFirebasePushNotification.Current.OnNotificationOpened += App.OnNotificationOpened; CrossFirebasePushNotification.Current.OnNotificationAction += App.OnNotificationOpened; }