Rich push image behavior
Push notifications can include an Image URL that displays as a rich media attachment. Layout differs by platform and Android OS version — this is expected platform behavior, not an SDK defect.
Prerequisites
- Push payload includes
image_url(HTTPS, publicly reachable, under ~1 MB) - Android: SDK renders the notification via
showActionableNotificationor turnkeysetupPushNotifications - iOS: Notification Service Extension (NSE) with
OpenCdpPushExtensionHelperandaps.mutable-content: 1
Step 1 — Add an image to your push
Dashboard: In the push editor, set the Image field to a public HTTPS URL.
API / FCM data payload:
{
"title": "Hello",
"body": "Check this out",
"image_url": "https://example.com/images/promo.jpg"
}
Step 2 — Android layout
The OpenCDP Android SDK uses NotificationCompat.BigPictureStyle. Collapsed layout depends on the device API level:
Android 12+ (API 31+) — collapsed:
┌─────────────────────────────────────┐
│ [icon] Title [thumb] ▼ │
│ Body text │
└─────────────────────────────────────┘
Android 12+ — expanded:
┌─────────────────────────────────────┐
│ [icon] Title │
│ Body text │
│ ┌─────────────────────────────────┐ │
│ │ Full image │ │
│ └─────────────────────────────────┘ │
└─────────────────────────────────────┘
Android 7–11 (API 24–30) — collapsed:
┌─────────────────────────────────────┐
│ [preview] Title ▼ │
│ Body text │
└─────────────────────────────────────┘
| State | Android 12+ (API 31+) | Android 7–11 (API 24–30) |
|---|---|---|
| Collapsed | App icon left; thumbnail right | Image preview left (setLargeIcon) |
| Expanded | Full-width image at bottom | Full-width image at bottom |
Right-side thumbnails on newer Android and left-side previews on older Android are intentional. The SDK branches on Build.VERSION.SDK_INT >= 31.
Step 3 — iOS layout
iOS uses a Notification Service Extension to download and attach the image before display.
- Set
aps.mutable-content: 1in the APNS payload whenimage_urlis present - Add NSE target using
OpenCdpPushExtensionHelper - Collapsed/expanded layout is controlled by iOS — not Android-style left/right thumbnails
- Without NSE: notification shows title and body only (no image)
See: Flutter push notifications (NSE setup) · iOS push example
Step 4 — Verify it worked
| Platform | What to check |
|---|---|
| Android 12+ | Collapsed: thumbnail on right; expanded: full image at bottom |
| Android 7–11 | Collapsed: preview on left; expanded: full image at bottom |
| iOS | Image attachment visible when NSE is wired |
| All | Delivery/open metrics still fire after image attach |
Enable debug: true and look for SDK logs confirming image download and notification post.
Text-only notification (no image)
If you expected an image but see title/body only:
| Cause | Fix |
|---|---|
No image_url in payload | Add Image URL in editor or payload |
| Image download failed | Use HTTPS, valid content-type, reachable URL; check logs |
Hybrid FCM payload (notification + data) | Send data-only on Android when SDK owns display |
| Custom handler not using SDK | Call showActionableNotification or setupPushNotifications |
| iOS missing NSE | Add Notification Service Extension |
Backend contract (summary)
| Field | Location | Notes |
|---|---|---|
image_url | FCM data / APNS custom data | HTTPS URL string |
custom_data | FCM data | JSON string of custom key-values |
actions | FCM data | JSON array of action buttons |
mutable-content | APNS aps | Required for iOS rich content |
Android: Prefer data-only FCM messages when the SDK renders notifications. Hybrid payloads can cause duplicate tray entries.
Troubleshooting
| Symptom | Likely cause | Action |
|---|---|---|
| Thumbnail on right (new phone) | Android 12+ expected | None — document for QA |
| Preview on left (old phone) | API 24–30 OS behavior | None — OS limitation |
| No image | Missing NSE (iOS) or no SDK render (Android) | Wire NSE / showActionableNotification |
| Duplicate notifications | Hybrid FCM payload | Use data-only Android push |
| Plain notification despite URL | Download failed | Check URL, HTTPS, size, logs |