flutterpush-notificationapple-push-notificationsintercom

intercom_flutter 8.1.3 iOS Push Notifications Doesn't Work


We are integrating the intercom into our Flutter app. On their official developer site, there is no Flutter SDK. But there is one on pub.dev intercom_flutter, which looks quite useful and well integrated with Android and iOS SDKs. It works with all the features but when I answer a thread via intercom console, my iphone doesn't receive a notification while Android does. Due to the iOS version limitations, altough there are more recent versions of the package, I am integrating the version 8.1.3. I followed all the instructions on the package page but still couldn't make it work. Does anyone experience the same problem?

I followed all the steps on the package page, including setting the token:

final firebaseMessaging = FirebaseMessaging.instance; final intercomToken = Platform.isIOS ? await firebaseMessaging.getAPNSToken() : await firebaseMessaging.getToken();

Intercom.instance.sendTokenToIntercom(intercomToken);


Solution

  • It looks like the flutter function that sets the device token on intercom doesn't work properly. On intercom iOS developer page I found a snippet for setting the APNS token on intercom. When I added a slightly modified version of it into AppDelegate.swift file, it worked.

        import Intercom
        ...
        ...
        override func application(
            _ application: UIApplication,
            didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    
             Intercom.setDeviceToken(deviceToken)
    
        }