CrossGeeks/AzurePushNotificationPlugin

OnNotificationOpened isn't being called on Android

Closed this issue · 1 comments

I have the following code in my Application OnCreate method.

#if DEBUG
    AzurePushNotificationManager.Initialize(this, Resources.GetString(connectionString,hubName, true);
#else
    AzurePushNotificationManager.Initialize(this, Resources.GetString(connectionString,hubName, false);
#endif

 CrossAzurePushNotification.Current.OnNotificationReceived += Current_OnNotificationReceived;  
 CrossAzurePushNotification.Current.OnNotificationOpened += Current_OnNotificationOpened; 
 CrossAzurePushNotification.Current.RegisterAsync(new string[] { "dev" });
private void Current_OnNotificationReceived(object source, AzurePushNotificationDataEventArgs e)
{
   //This gets hit
}

 private void Current_OnNotificationOpened(object source, AzurePushNotificationResponseEventArgs e)
{
   //This does not get hit
}

When I send a Firebase Push Notification, my phone will display the notification properly in the tray. When I tap on the notification, my app will open, but the OnNotificationOpened event is not fired.

My notification looks like this.

{
  "message":{
    "token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
    "notification":{
      "title":"My Title",
      "body":"My Body"
    }
  }
}

I didn't realize that there was already another issue for this. I fixed it using this solution.

#5 (comment)