79769554

Date: 2025-09-19 13:20:27
Score: 1
Natty:
Report link

Solution found here https://proandroiddev.com/display-android-notifications-with-a-contact-image-on-the-left-like-all-messaging-apps-bbd108f5d147, it says setting

.setLongLived(true) on ShortcutInfo is optional but it is required true

for rounding drawable

public static IconCompat getRoundIcon(Context context){
        Drawable drawable = ContextCompat.getDrawable(context, R.drawable.pexels_lancehe_14653174);
        if(drawable == null)
            return null;
        Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();

        RoundedBitmapDrawable roundedDrawable =
                RoundedBitmapDrawableFactory.create(context.getResources(), bitmap);
        roundedDrawable.setCircular(true);

        Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(output);
        roundedDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        roundedDrawable.draw(canvas);

        return IconCompat.createWithBitmap(output);
    }
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: IronFist