Skip to content

OnNotificationOpened not hit when app killed on Android #407

Open
@cvchris

Description

@cvchris

🐛 Bug Report

The notification comes through even when app is killed, but when clicking on notification, it doesn't run OnNotificationOpened method (which is on MainApplication.cs) and the body is:


CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) =>
            {
                string tag = "aimmsapp";

                Android.Util.Log.Info(tag, "Opened");
                System.Diagnostics.Debug.WriteLine("Opened");
                foreach (var data in p.Data)
                {
                    System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}");
                }


            };

I can see from the device logs that this method is not ran, but when the device is in background, it runs when I click the notification.

The payload sent is:

var pushData = new
                {
                    to = deviceToken,
                    content_available = true,
                    data = new
                    {
                        body = message, 
                        payload = new
                        {
                            android = new
                            {
                                title = title,
                                alert = message,
                                sound = "default",
                                vibrate = true,
                                icon = "appicon"
                            },
                        },
                        extData = extData
                    },
                    priority = "high"
                };

Expected behavior

It should ran OnNotificationOpened method on MainApplication when I click the notification.

Reproduction steps

Kill the app, and send notification. OnNotificationOpened method should not ran when clicking the notification.

Configuration

Bug on Poco X3 NFC and Samsung Galaxy tab A (2016)
Version: 3.4.1

Platform:

  • 📱 iOS
  • 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • 🐒 Xamarin.Forms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions