My .net MAUI Blazor Hybrid App is receiving push notifications via Firebase cloud messaging. Users can subscribe to a specific "action" which I set on the Topic property of the Message. The notifications is shown on the (android) device. I can click on it and the app is opening.
Now I want to handle the extra data in the message to navigate to a specific page within the app.
I send the message in the following way:
var message = new Message
{
Notification = new Notification
{
Title = title,
Body = body
ImageUrl = "..."
},
Topic = action,
Data = new Dictionary
{
{ "articleId", "123" },
{ "targetPage", "ArticlePage" }
},
Android = new AndroidConfig
{
Notification = new AndroidNotification
{
ClickAction = "OPEN_ARTICLE"
}
}
};
var response = await FirebaseMessaging.DefaultInstance.SendAsync(message);
In the app the code looks like
protected override void OnNewIntent(Intent? intent)
{
base.OnNewIntent(intent);
HandleIntent(intent);
}
But intent.Data and intent.Extra are both null. How can I get the additional data from the dictionary?