feat: generate Android FirebaseMessagingService for Expo push notifications#385
feat: generate Android FirebaseMessagingService for Expo push notifications#385Rosie-Kennelly-1 wants to merge 1 commit intomainfrom
Conversation
…ations Adds an Expo config plugin that generates a Kotlin FirebaseMessagingService at prebuild time. The service forwards FCM tokens and Intercom push messages to the Intercom SDK, and passes non-Intercom messages through to other handlers. Also conditionally adds the firebase-messaging gradle dependency to the app module when not already present. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hey! I was reviewing this PR chain (#383, #385, #384) and wanted to flag a potential issue with how the generated The concern: Android only dispatches Priority conflict breakdown:
If we don't skip and do register at priority 10, Intercom pushes work but Possible fix: conditionally extend // When expo-notifications is installed:
class IntercomFirebaseMessagingService : ExpoFirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) {
if (IntercomModule.isIntercomPush(remoteMessage)) {
IntercomModule.handleRemotePushMessage(application, remoteMessage)
} else {
super.onMessageReceived(remoteMessage) // → Expo handles it
}
}
}The config plugin could detect This would cover the common case where an Expo app uses both |
Why?
towards: https://github.com/intercom/intercom/issues/360467
The Expo config plugin automates iOS push notification setup (since PR #191) but has no Android equivalent. Expo developers' end users silently never receive push notifications on Android when a support agent replies — the only workaround is manually creating native Kotlin files, which defeats the purpose of using Expo.
How?
A new config plugin generates a Kotlin
FirebaseMessagingServiceatexpo prebuildtime that forwards Intercom pushes to the SDK and passes non-Intercom messages through for other handlers. Also conditionally addsfirebase-messagingto the app module'sbuild.gradle(the native module declares it asimplementation/private, so the app module needs its own copy).Part 1 of 2 — manifest registration and plugin wiring follow in:
Related:
Generated with Claude Code