I have problem setting up a notification image to display properly.
Below is the original image, with file path:
myApp\Resources\drawable\Icon.png
Dimensions: 72x72pixels, 32bit depths
The problem:
It displays like below.
Below is the code. The code seems working correctly for previous version which displays it properly.
public class MyServiceConnection : Java.Lang.Object, IServiceConnection
{
private string _appName;
public MyServiceConnection(string appName)
{
_appName = appName;
}
public void OnServiceConnected(ComponentName name, IBinder service)
{
var intent = new Intent(Application.Context, typeof(ManifestActivity));
intent.AddFlags(ActivityFlags.ClearTop);
var pendingIntent = PendingIntent.GetActivity(Application.Context, 0, intent, PendingIntentFlags.UpdateCurrent);
var notificationBuilder = new NotificationCompat.Builder(Application.Context)
.SetSmallIcon(Resource.Drawable.Icon)
.SetContentTitle(_appName)
.SetAutoCancel(true)
.SetContentIntent(pendingIntent);
var notificationManager = NotificationManager.FromContext(Application.Context);
var notification = notificationBuilder.Build();
notificationManager.Notify(1, notification);
var serviceBinder = service as MyService.Binder;
serviceBinder.StartForeground(1, notification);
}
public void OnServiceDisconnected(ComponentName name)
{
}
}
Envoironments:
android:minSdkVersion="15" android:targetSdkVersion="27"