.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
4,084 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am using below code to show the push notification icon in my MAUI application:
private void CreateNotificationChannel()
{
try
{
var channelId = $"{PackageName}.general";
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
var channel = new NotificationChannel(channelId, "General", NotificationImportance.Default);
notificationManager.CreateNotificationChannel(channel);
FirebaseCloudMessagingImplementation.ChannelId = channelId;
FirebaseCloudMessagingImplementation.SmallIconRef = global::ProjectNameSpace.Resource.Drawable.ic_notification;
}
catch (Exception exception)
{
Utility.SendCrashReport(exception);
}
}
This icon is working fine upto android version 14, but in 15 the icon is breaking. Check the below screenshot. Inside the blue circle a grey square is showing, the real icon is not showing. I have added the icon in Platforms-Android-Resource-Drawable and build action set to None.
I also tried using the app icon from single project like below, but no luck.
using Resource = Microsoft.Maui.Resource;
FirebaseCloudMessagingImplementation.SmallIconRef = Resource.Mipmap.appicon;