我正在尝试在我的 .Net Maui 应用程序上实现 firebase 推送通知。当我尝试将我的 appicon 设置为通知的小图标时,它无法被识别。
这适用于 xamarin.forms。谁能帮我解决这个问题吗?
您可以将图像放在MAUI中的
Resources/Images
文件夹中。 Maui 和 Xamarin 之间有所不同。然后将错误的代码更改为Resource.Drawable.appicon
。
var notificationBuilder = new NotificationCompat.Builder(this, MainActivity.ChannelID)
.SetSmallIcon(Resource.Drawable.appicon)
.SetContentTitle(title)
.SetContentText(messageBody)
.SetChannelId(MainActivity.ChannelID)
.SetPriority((int)NotificationPriority.High);
var notificationManager = NotificationManagerCompat.From(this);
notificationManager.Notify(MainActivity.NotificationID, notificationBuilder.Build());