Plugin.FirebasePushNotifications
Plugin.FirebasePushNotifications copied to clipboard
[Bug] NullReferenceException at Plugin.FirebasePushNotifications.Platforms.FirebasePushNotificationManagerBase.set_NotificationCategories(NotificationCategory[] value)
Description
When calling RegisterNotificationCategories too early, you get a NullReferenceException
Steps to Reproduce
In my MainPage constructor, I call this code :
CrossFirebasePushNotification.Current.TokenRefreshed += OnTokenRefresh;
CrossFirebasePushNotification.Current.NotificationOpened += OnNotificationOpenedAsync;
CrossFirebasePushNotification.Current.NotificationReceived += OnNotificationReceivedAsync;
CrossFirebasePushNotification.Current.NotificationDeleted += OnNotificationDeletedAsync;
CrossFirebasePushNotification.Current.NotificationAction += OnNotificationActionAsync;
var notificationCategories = new NotificationCategory[]
{
new NotificationCategory("dismiss",new NotificationAction[] {
new NotificationAction("Dismiss","Dismiss", NotificationActionType.Default),
}),
new NotificationCategory("navigate",new NotificationAction[] {
new NotificationAction("Dismiss","Dismiss", NotificationActionType.Default),
new NotificationAction("Navigate","Navigate To", NotificationActionType.Foreground)
})
};
CrossFirebasePushNotification.Current.RegisterNotificationCategories(notificationCategories);
Expected Behavior
Actual Behavior
---> System.NullReferenceException: Object reference not set to an instance of an object. at Plugin.FirebasePushNotifications.Platforms.FirebasePushNotificationManagerBase.set_NotificationCategories(NotificationCategory[] value) at Plugin.FirebasePushNotifications.Platforms.FirebasePushNotificationManagerBase.RegisterNotificationCategories(NotificationCategory[] notificationCategories)
Basic Information
- Version with issue: 2.3.12
- Last known good version: never