Here's how you scale the resulting bitmap, where the 2nd and 3rd arguments are equal to the width and height, respectively
Bitmap b = Bitmap.createScaledBitmap(receivedBitmap, 120, 120, false);
If you want to scale while maintaining the aspect ratio to fit your width, do this
public Bitmap getResizedBitmap(Bitmap bm, int width ) { float aspectRatio = bm.getWidth() / (float) bm.getHeight(); height = Math.round(width / aspectRatio); Bitmap resizedBitmap = Bitmap.createScaledBitmap( bm, width, height, false); return resizedBitmap; }
and to generate a notification with a scaled bitmap use
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification.Builder(mContext) .setContentTitle("set title") .setContentText("Swipe Down to View") .setSmallIcon(mContext.getApplicationInfo().icon) .setLargeIcon(receivedBitmap) .setContentIntent(pendingIntent) .setDefaults(Notification.DEFAULT_SOUND) .setStyle(new Notification.BigPictureStyle() .bigPicture(b)) .setPriority(Notification.PRIORITY_HIGH) .setVibrate(new long[0]) .build();
source share