Skip to content

Add notification icon fallback chain for Firebase and standard Android conventions#1008

Open
davidtruong wants to merge 1 commit intomasterfrom
claude/resolve-issue-976-mnCJc
Open

Add notification icon fallback chain for Firebase and standard Android conventions#1008
davidtruong wants to merge 1 commit intomasterfrom
claude/resolve-issue-976-mnCJc

Conversation

@davidtruong
Copy link
Copy Markdown
Contributor

🔹 Jira Ticket(s) if any

✏️ Description

Implements a comprehensive notification icon fallback chain to support multiple icon configuration conventions. The SDK now checks for notification icons in the following priority order:

  1. Iterable-specific metadata (iterable_notification_icon)
  2. Firebase default notification icon metadata (com.google.firebase.messaging.default_notification_icon)
  3. Standard Android drawable resources (notification_icon)
  4. Standard Android drawable resources (ic_notification)
  5. Application default icon (fallback)

This change improves compatibility with Firebase Cloud Messaging and other common Android notification icon conventions, allowing developers to configure notification icons using standard practices without requiring Iterable-specific metadata.

Changes Made

  • IterableConstants.java: Added three new constants for Firebase and standard Android icon keys/names
  • IterableNotificationHelper.java: Enhanced getIconId() method to check Firebase metadata and standard Android drawable resources before falling back to app icon
  • IterableNotificationWorker.kt: Applied the same icon fallback logic in Kotlin implementation
  • IterableNotificationTest.java: Added three comprehensive unit tests covering:
    • Fallback to app icon when no custom icons are configured
    • Fallback to Firebase metadata icon
    • Priority of Iterable metadata over Firebase metadata

Test Plan

Added unit tests that verify the icon fallback chain works correctly at each level. Existing tests continue to pass.

https://claude.ai/code/session_01JNHse78oK4wYWnqfeCtwm6

Before falling back to the app launcher icon (which shows as a white
square on Android 5.0+), the SDK now checks these standard locations:

1. Firebase default notification icon metadata
2. @drawable/notification_icon (Expo convention)
3. @drawable/ic_notification (common Android convention)

This allows the SDK to automatically use notification icons configured
through Expo, Firebase, or other common frameworks without requiring
manual iterable_notification_icon configuration.

Fixes #976

https://claude.ai/code/session_01JNHse78oK4wYWnqfeCtwm6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants