setBanner
Sets a large image to be displayed in the notification using Android's BigPictureStyle.
The banner image is displayed when the notification is expanded and provides a rich visual experience. The image is downloaded and cached when the notification is displayed. Example:
// E-commerce flash sale with product image
LocalNotification saleNotification = new LocalNotification.Builder()
.setMessage("50% off on selected items!")
.setBanner("https://cdn.example.com/flash-sale-banner.jpg")
.setLink("myapp://sale")
.setDelay(3600)
.build();
// News article with feature image
LocalNotification newsAlert = new LocalNotification.Builder()
.setMessage("Breaking: Major event update")
.setBanner("https://news.example.com/article-image.jpg")
.setLink("newsapp://article/12345")
.setDelay(1800)
.build();
// Fitness achievement with motivational image
LocalNotification achievement = new LocalNotification.Builder()
.setMessage("Congratulations! You reached your goal!")
.setBanner("https://cdn.fitnessapp.com/achievement-badge.png")
.setDelay(7200)
.build();
Content copied to clipboard
Best Practices:
- Use high-resolution images (at least 450x450 pixels)
- Keep file size reasonable (under 1MB) for faster loading
- Use JPEG or PNG formats
- Images are downloaded when notification is displayed, so ensure URLs are accessible
Return
this builder instance for method chaining
Parameters
url
image URL (must be publicly accessible)
See also
<a href="https://developer.android.com/reference/android/app/Notification.BigPictureStyle.html">Android BigPictureStyle</a>