Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CrossFirebasePushNotification.Current.OnNotificationOpened Event is not firing #452

Open
anilrawatGH opened this issue Jan 4, 2023 · 0 comments

Comments

@anilrawatGH
Copy link

💬 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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant