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.
Not had a chance to check it yet but API 11 introduced the following public dimens:
Should be able to use those to scale your image before setting it on the notification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With