setSmallIcon

Sets the small icon displayed in the notification status bar and notification content.

The small icon appears in the device's status bar and as a small icon in the notification itself. This should be a simple, monochromatic icon from your app's drawable resources. Example:


		  // Use custom notification icon
		  LocalNotification withIcon = new LocalNotification.Builder()
		      .setMessage("New message received")
		      .setSmallIcon("ic_notification") // Refers to res/drawable/ic_notification.png
		      .setDelay(300)
		      .build();
		
		  // Use different icons for different notification types
		  LocalNotification cartIcon = new LocalNotification.Builder()
		      .setMessage("Items in your cart")
		      .setSmallIcon("ic_cart")
		      .setDelay(3600)
		      .build();
		
		  LocalNotification saleIcon = new LocalNotification.Builder()
		      .setMessage("Flash sale alert!")
		      .setSmallIcon("ic_sale")
		      .setDelay(7200)
		      .build();
		

Best Practices:

  • Use white icon with transparent background for Android 5.0+ (API 21+)
  • Provide multiple densities (mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi)
  • Recommended size: 24x24 dp
  • Keep design simple - complex icons don't work well at small sizes
  • If not set, SDK uses the app's default notification icon

Return

this builder instance for method chaining

Parameters

name

drawable resource name (without extension, e.g., "ic_notification")