Hi,
Push notification handling does not work at all on 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