FirebasePushNotificationPlugin icon indicating copy to clipboard operation
FirebasePushNotificationPlugin copied to clipboard

CrossFirebasePushNotification.Current.OnNotificationOpened Event is not firing

Open anilrawatGH opened this issue 3 years ago • 0 comments

💬 Questions and Help

I have a Xamarin project in which for sending the notifications I am using Firebase Push Notification Plugin for Xamarin Android.

In Android, Open received notification from Notification Bar is not firing the OnNotificationOpened or OnNotificationAction Events. Code inside CrossFirebasePushNotification.Current.OnNotificationOpened Event should be executed.

In App.xaml.cs class constructor, I have triggered both Current_OnNotificationOpened and Current_OnNotificationAction events. public App() { CrossFirebasePushNotification.Current.OnNotificationOpened += Current_OnNotificationOpened; CrossFirebasePushNotification.Current.OnNotificationAction += Current_OnNotificationAction; }

I have also tried to move Current_OnNotificationOpened and Current_OnNotificationAction events in OnStart() method.

In MainActivity.cs class, I am using below code

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState);
LoadApplication(new App()); FirebasePushNotificationManager.ProcessIntent(this, Intent);
} }

In MainApplication.cs class, I have the below code

public override void OnCreate() { base.OnCreate(); //Set the default notification channel for your app when running Android Oreo if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { //Change for your default notification channel id here FirebasePushNotificationManager.DefaultNotificationChannelId = "FCMJTSChannelId"; //Change for your default notification channel name here FirebasePushNotificationManager.DefaultNotificationChannelName = "JTSChannel"; FirebasePushNotificationManager.DefaultNotificationChannelImportance = NotificationImportance.Max; } #if DEBUG FirebasePushNotificationManager.Initialize(this, true); #else FirebasePushNotificationManager.Initialize(this, false); #endif }

anilrawatGH avatar Jan 04 '23 06:01 anilrawatGH