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)
{
}
}
Environments:
android:minSdkVersion="15" android:targetSdkVersion="27"
Update
As I mentioned, the same code and same png file are used and working now on a separate apk. Once the code was created for a second branch, the issue occurs on the second branch.
Update 2
I fixed it by changing below
Project Properties -> Android Manifest -> Target Android Version to "Use Compile using SDK version"
which results in below:
android:minSdkVersion="15"
What does it mean by "Use Compile using SDK version"? What target version is being used when installed on Lollipop?