react-native-intercom: Adnroid version 13.0.1 push notifications doesn't work

I am using RN 59.10 and I was using version 12.5.1 and everything worked fine. Then I upgraded to 13.0.1 and I was not able to receive push notifications. I downgraded to 12.5.1 and it work again. In logs I catch this error: AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.robinpowered.react.Intercom.IntercomIntentService" on path: DexPathList[[zip file "/data/app/com.myapp.app-MjCojLNq91ID9dVsmf902Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp.app-MjCojLNq91ID9dVsmf902Q==/lib/arm64, /data/app/com.myapp.app-MjCojLNq91ID9dVsmf902Q==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /product/lib64]]

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 16 (1 by maintainers)

Most upvoted comments

You no longer need the IntercomIntentService after v13, so you can just remove it from your AndroidManifest.xml

See -> https://github.com/tinycreative/react-native-intercom/releases/tag/v13.0.0

What worked for me was:

  1. changing intercom sdk version to implementation 'io.intercom.android:intercom-sdk:6.+

  2. sending FCM to Intercom Intercom.sendTokenToIntercom(token)

  3. IMPORTANT! Leaving just one <action android:name="com.google.firebase.MESSAGING_EVENT" /> in AndroidManifest.xml I had three of them, one from expoKit, one from react-native-firebase and one from intercom. I left only the one from intercom, which was already extending RNFirebaseMessagingService

@MayoudP , I used to make Intercom work with OneSignal, it didn’t require Firebase before, I just did

    OneSignal.addEventListener('ids', device => {
      const { userId, pushToken } = device;
      Intercom.sendTokenToIntercom(pushToken)
    });

This gives me a valid push token, and Intercom support tells me they actually receive it. I can also send pushes from FCM console with this token and receive them.

However, if I try to send a push through Intercom interface, I don’t receive them anymore (in 13.0 installDebug build).

Worst: it used to work in production (afaik, older Intercom SDK) and now it doesn’t… so it means it’s actually not this update (this is not published yet) that broke the android pushes in our app. Sadly we only noticed now that this is not working for a while.

To me it looks like there’s something wrong with Intercom. My app is able to receive pushes sent by a curl command, but not pushes sent by the interface, yet the support tells me they see and received the token I sent them.

curl -X POST --header 'Authorization: key=xxx' \
    --Header "Content-Type: application/json" \
    https://fcm.googleapis.com/fcm/send \
    -d "{\"to\":\"xxx\",\"notification\":{\"body\":\"ENTER YOUR MESSAGE HERE\"}}"

Note that in the FCM dashboard it does not even show their push attempts (we are in prod for a while and afaik android intercom pushes used to work… not anymore).

image

Edit: problem is definitively on their side, their logs show “push sent to GCM”, see https://twitter.com/sebastienlorber/status/1227665034312134656

@MayoudP Ok, I deleted all other services which are related to firebase.MESSAGING_EVENT from AndroidManifest.xml, then it seems working

Hello @tuncaulubilge This is my manifest :

    <application
      android:name=".MainApplication"
      android:launchMode="singleTop"
      xmlns:tools="http://schemas.android.com/tools"
    >
      <activity
        android:name=".MainActivity"
         android:configChanges="keyboard|keyboardHidden|screenSize" android:windowSoftInputMode="adjustPan"
        android:launchMode="singleTask">

       <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <meta-data android:name="asset_statements" android:resource="@string/asset_statements" />
      <meta-data android:name="com.onesignal.NotificationAccentColor.DEFAULT" android:value="0009A5" />

       <service
          android:name=".MainMessagingService"
          android:enabled="true"
          android:exported="true">
            <intent-filter>
              <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <receiver
            android:name="io.intercom.android.sdk.push.IntercomPushBroadcastReceiver"
            tools:replace="android:exported"
            android:exported="true" />
     </application>

And MyMessaginService (because I’m also using OneSignal for my push notifications, so need to handle both services I guess as explained in the doc…

...
import io.intercom.android.sdk.push.IntercomPushClient;
import com.google.firebase.messaging.RemoteMessage;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.onesignal.OSNotificationPayload;
import com.onesignal.NotificationExtenderService;
import com.onesignal.OSNotificationReceivedResult;

public class MainMessagingService extends FirebaseMessagingService {
    private static final String TAG = "MainMessagingService";
    private final IntercomPushClient intercomPushClient = new IntercomPushClient();

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        Map message = remoteMessage.getData();
        if (intercomPushClient.isIntercomPush(message)) {
            intercomPushClient.handlePush(getApplication(), message);
        } else {
            super.onMessageReceived(remoteMessage);
            // DO HOST LOGIC HERE
        }
    }
}

Versions :

package.json : 
    "react-native-intercom": "13.1.0",
     react-native: 0.59.1
build.gradle:
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-analytics:15.0.0'
        // From node_modules
    //implementation 'io.intercom.android:intercom-sdk:5.+'
    implementation 'io.intercom.android:intercom-sdk-fcm:5.+'

OneSignal push notifications are working very well, but Intercom ones doens’t, I never received them. I tried literally everythings… Did you have any tips or hint to help me please and make it works 😢 ?