question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NotificationOpened not firing

See original GitHub issue

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 2.3.0 Device Tested On: Simulator Tested On: Emulator Android 8.1 27 Version of VS: 2017 Enterprise Version of Xamarin: 3.0.0.561731 Versions of other things you are using:

Steps to reproduce the Behavior

Create a notification and subscribe to it, then setup a OnNotificationReceived event handler

Expected Behavior

When clicking on the buttons (Reply , Forward) it should trigger the above event

Actual Behavior

App Launches, no event triggered.

Code snippet

MainApplication.cs

public override void OnCreate()
        {
            base.OnCreate();

            //Set the default notification channel for your app when running Android Oreo
            if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
            {
                //Change for your default notification channel id here
                FirebasePushNotificationManager.DefaultNotificationChannelId = "DefaultChannel";

                //Change for your default notification channel name here
                FirebasePushNotificationManager.DefaultNotificationChannelName = "General";
            }



            //If debug you should reset the token each time.
#if DEBUG
            FirebasePushNotificationManager.Initialize(this,
                          new NotificationUserCategory[]
                          {
                    new NotificationUserCategory("message",new List<NotificationUserAction> {
                        new NotificationUserAction("Reply","Reply", NotificationActionType.Foreground),
                        new NotificationUserAction("Forward","Forward", NotificationActionType.Foreground)

                    })
                          },true);
#else
  FirebasePushNotificationManager.Initialize(this,
                new NotificationUserCategory[]
                {
                    new NotificationUserCategory("message",new List<NotificationUserAction> {
                        new NotificationUserAction("Reply","Reply", NotificationActionType.Foreground),
                        new NotificationUserAction("Forward","Forward", NotificationActionType.Foreground)

                    }),
                    new NotificationUserCategory("request",new List<NotificationUserAction> {
                    new NotificationUserAction("Accept","Accept", NotificationActionType.Default, "check"),
                    new NotificationUserAction("Reject","Reject", NotificationActionType.Default, "cancel")
                    })
                }, false);
#endif

            //Handle notification when app is closed here
            CrossFirebasePushNotification.Current.Subscribe("general");
            CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
            {
                //Toast.MakeText(ApplicationContext, "Hello", ToastLength.Long).Show();

            };

            CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) =>
            {
                //Fired;
            };

MainActivity.cs

[Activity(Label = "Notifications2", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
            FirebasePushNotificationManager.ProcessIntent(this,Intent);

        }
    }

Screenshots

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
rdelrosariocommented, Jul 20, 2018
protected override void OnNewIntent(Intent intent)
       {
           base.OnNewIntent(intent);
           FirebasePushNotificationManager.ProcessIntent(this,intent);
       }
0reactions
josegomezcommented, Jul 20, 2018

Perfect thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug]: NotificationOpened method is not triggering when ...
If I click on this notification the app is opened and triggered "NotificationOpened" event. So, everything is fine (works both android and iOS)....
Read more >
Android - OneSignal callback methods never fired ...
I'm using onesignal to push notification and it works fine but i faced an issue with "Receiving Notifications" since i want to take...
Read more >
"Push Notifications" Component's "Notification Opened" is ...
“Push Notifications” Component's “Notification Opened” is not invoked, when the app is opened by clicking the corresponding notification.
Read more >
Handling Notification Events | React Native Notifications
Background: notificationReceivedBackground event will be fired, do not forget to invoke completion() callback. To receive background notifications on iOS follow ...
Read more >
Notification Open trigger - Bug
I am talking about the trigger event “Notification opened”. ... least weird as the notification is being sent and not received nor opened....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found