0

I am using azure push notification in my Xamarin forms app. Now I am getting push notification data when app is open. But when app already login and app is in background how can i get my push notification data. Now i am getting this data from this method.

public override void OnMessageReceived(RemoteMessage message)
{
    base.OnMessageReceived(message); 
    var msgData = message.Data; 
    var NotificationMessage = msgData["action"];

    var NotificationObj = JsonConvert.DeserializeObject<NotificationData>(NotificationMessage);
    ShowNotification(message.GetNotification().Body, message.GetNotification().Title, NotificationObj.Notification[0].OpenPage.ToString(), NotificationObj.AppName.ToString(), NotificationMessage);
}

Is it possible to get this data to splash screeen. or is there another better way to do this. please give some suggesions

AlexDemo
  • 59
  • 6
  • Try to use json key `notification` instead of `data` in azure web portal when send notification ,`onMessageReceived` method would trigger if even your application is in background or closed , refer to https://stackoverflow.com/a/57851121/8187800 . – ColeX - MSFT Sep 08 '21 at 09:45

0 Answers0