getLargeIcon

protected open fun getLargeIcon(pushData: PushMessage): Bitmap

Loads and returns the large icon image for the notification.

The large icon appears on the right side of the notification (or left on some devices) and provides a visual identifier for your app or the notification content. This method downloads the image from the URL specified in the push payload's "pw_large_icon" attribute.

The image is automatically sized to match the system's notification_large_icon_height dimension (typically 64dp x 64dp). This method runs on a worker thread, so network operations are safe.

Image Requirements:

  • Recommended size: 256x256 (will be scaled down)
  • Should be square or circular
  • Supported formats: JPEG, PNG
  • Transparent backgrounds work well

Override this method to customize image loading or apply circular cropping, rounded corners, or other transformations. Example - Custom image with circular crop:


  
  protected Bitmap getLargeIcon(PushMessage pushData) {
      String iconUrl = pushData.getLargeIconUrl();
      if (iconUrl == null) {
          // Fall back to app icon
          return BitmapFactory.decodeResource(
              getApplicationContext().getResources(),
              R.drawable.ic_launcher
          );
      }

      try {
          // Load and apply circular transformation
          Bitmap bitmap = Glide.with(getApplicationContext())
              .asBitmap()
              .load(iconUrl)
              .transform(new CircleCrop())
              .submit(256, 256)
              .get();
          return bitmap;
      } catch (Exception e) {
          Log.e("NotificationFactory", "Failed to load large icon", e);
          return null;
      }
  }

Return

Bitmap to display as notification large icon, or null if URL is not specified or loading fails

Parameters

pushData

Push notification data containing the large icon URL

See also