I find myself curious why the setLargeIcon method on Notification.Builder only accepts a Bitmap, with no overload to provide a resource id. Perhaps it was done for performance reasons, but it seems odd as setSmallIcon does accept a res drawable id.
Notification.Builder builder = new Notification.Builder(application);
// ....
builder.setLargeIcon(iconBitmap); // Requires a Bitmap
builder.setSmallIcon(iconResId); // Requires a drawable resource ID
Notification notification = builder.getNotification();
Sadly the bitmap provided is not scaled in the notification, so the Bitmap needs to be provided exactly the right size for the notification view.
Assuming I need to provide xhdpi, hdpi, mdpi and ldpi versions of the largeIcon bitmap, what sizes do they need to be? I can see no mention in the docs, or after scouring the wider web.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…