setLargeIcon
Sets the large icon displayed on the left side of the notification.
The large icon is a circular image displayed prominently in the notification. It's typically used for user avatars, app branding, or context-specific imagery. The image is downloaded from the provided URL when the notification is displayed. Example:
// E-commerce notification with product thumbnail
LocalNotification productNotification = new LocalNotification.Builder()
.setMessage("Your favorite item is back in stock!")
.setLargeIcon("https://cdn.example.com/products/item-thumb.jpg")
.setLink("myapp://products/12345")
.setDelay(3600)
.build();
// News app with article thumbnail
LocalNotification newsNotification = new LocalNotification.Builder()
.setMessage("Breaking news update")
.setLargeIcon("https://news.example.com/article-thumb.jpg")
.setLink("newsapp://article/67890")
.setDelay(1800)
.build();
// Fitness app with achievement badge
LocalNotification achievementNotification = new LocalNotification.Builder()
.setMessage("You earned a new badge!")
.setLargeIcon("https://cdn.fitnessapp.com/badges/runner-gold.png")
.setDelay(7200)
.build();
Content copied to clipboard
Best Practices:
- Use square images (Android will automatically crop to circular)
- Recommended size: 256x256 pixels or larger
- Keep file size reasonable (under 500KB) for faster loading
- Image is displayed in a circle on Android 5.0+ (API 21+)
- URL must be publicly accessible when notification is displayed
Return
this builder instance for method chaining
Parameters
url
image URL (must be publicly accessible)