How to use a svg file as icon in a .net maui class library?
I'm moving some code to a sub project, for better modularity. As I don't want to reference the main app, I want to import the resource to this sub project.
Here is the code I need help with:
var notificationBuilder = new NotificationCompat.Builder(this, MyActivity.Channel_ID)
.SetContentTitle(title)
.SetSmallIcon(Resource.mipmap.appicon)
.SetContentText(messageBody)
.SetChannelId(MyActivity.Channel_ID)
.SetContentIntent(pendingIntent)
.SetAutoCancel(true)
.SetPriority((int)NotificationPriority.Max);
I copied the svg file to a new resource folder in the sub project. I have tried build action embedded resource and MauiIcon. But I don't get a resource to be made. I've tried adding properties/Resources.resx, I fill in the values and choose the file, but nothing gets populated in the list. perhaps it only wants .ico files and not .svg.
I've manually added this to my project file:
<ItemGroup>
<MauiIcon Include="Resources\AppIcon\appicon2.svg">
<Color>#512BD4</Color>
<ForegroundFile>Resources\AppIcon\appiconfg2.svg</ForegroundFile>
</MauiIcon>
</ItemGroup>
But in the code, I don't know how to refer to the icon. It does not populate after Resource. What else should I try to be able to setSmallIcon ? It does not understand mipmap or AppIcon