Android Push Notification handling in Expo + expo-notifications | Community
Skip to main content

Hi,

Push notification handling does not work at all on Android + Expo - When opening a push notification from either a terminated, or backgrounded app, the message does not open in Intercom, as it does on iOS, and as is expected.

This issue can be replicated in your ‘expo-example’ at https://github.com/intercom/intercom-react-native/tree/main/examples/expo-example

I have tested using the Expo SDK version in the your `expo-example`, and using the latest Expo version.

 

I have also attempted to fix this issue with some native Android code as suggested by ‘Fin’:
In MainNotificationService.java

package com.example; // Replace with your package import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.RemoteMessage; import com.intercom.reactnative.IntercomModule;

public class MainNotificationService extends FirebaseMessagingService {     @Override     public void onNewToken(String refreshedToken) {         IntercomModule.sendTokenToIntercom(getApplication(), refreshedToken);     }          public void onMessageReceived(RemoteMessage remoteMessage) {         if (IntercomModule.isIntercomPush(remoteMessage)) {             IntercomModule.handleRemotePushMessage(getApplication(), remoteMessage);         }     } }

And in AndroidManifest.json
<service android:name=".MainNotificationService">     <intent-filter>         <action android:name="com.google.firebase.MESSAGING_EVENT"/>     </intent-filter> </service> <receiver android:name="com.intercom.reactnative.RNIntercomPushBroadcastReceiver"      tools:replace="android:exported"      android:exported="true"/>

which did allow the Intercom message to be opened when the notification was tapped while the app was backgrounded, but does not work when the app was terminated (it opens and immediately closes the message).

Adding the above native code did also cause the following error to be logged, so seems to not be a suitable solution:
ERROR  Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that: - You don't have multiple NavigationContainers in the app each with 'linking' enabled - Only a single instance of the root component is rendered - You have set 'android:launchMode=singleTask' in the '<activity />' section of the 'AndroidManifest.xml' file to avoid launching multiple instances

 

Is there any official guidance or examples on getting full Android + Expo push notification support, or is this a known limitation? It would be great if the official ‘expo-example’ app fully worked.

Thanks for your help

Hi ​@Rob Walker! Seán here from the Intercom engineering support team 👋 how are you doing today?

Thanks for providing so much detail this really helps. Intercom push notifications are not supported when using the Expo config plugin extension. This limitation is specific to Expo's environment—not the Intercom React Native SDK itself.

As a result, push notifications (including those sent via Intercom) will not work when using Expo Go or a project that hasn't been rebuilt with native code support. Unfortunately, there is currently no workaround within the standard Expo setup to enable full Intercom push notification support.

This is a known limitation and is currently under review by our product team. In the meantime, if push notifications are essential to your workflow, we recommend handling push notifications manually via another push library, and routing relevant messages from Intercom yourself.

This plugin enables Intercom SDK functionality in a custom native build using EAS Build or expo run:*, but it does not work in Expo Go, and Expo's default push notification system is incompatible with Intercom’s native push setup.

Hope this helps clear things up and if you’ve any questions on it please let me know!


Thanks for your reply ​@Sean M 

Yeah, I figured there was some conflict between `expo-notfications` and Intercoms notification setup. It would be helpful if that was made clearer in the package repo and/or the Intercom docs.

 

I will have a go (if I can find the time!) at removing the `@intercom/intercom-react-native` config plugin, and making the necessary native changes myself in a custom config plugin, and then try to handle the Intercom notifications directly via expo-notifications. I will report back if I have any success!