Closed devalp-pro closed 1 year ago
Up
Could you provide the intercom version you're using, the output from flutter doctor
and a minimal sample code to try to reproduce it?
I tested this with the latest version: intercom_flutter: 7.6.0
.
It also crashed when you tap on the notification.
Working fine with version intercom_flutter: 7.5.0
. Need to report this issue to Intercom.
E/AndroidRuntime( 6131): java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from android.widget.FrameLayout{8e33f2a V.E...... ......ID 0,0-1080,2205 #7f0801aa app:id/intercom_overlay_root}
E/AndroidRuntime( 6131): at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer(WindowRecomposer.android.kt:349)
E/AndroidRuntime( 6131): at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer$default(WindowRecomposer.android.kt:324)
E/AndroidRuntime( 6131): at androidx.compose.ui.platform.WindowRecomposerFactory$Companion$LifecycleAware$1.createRecomposer(WindowRecomposer.android.kt:168)
E/AndroidRuntime( 6131): at androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release(WindowRecomposer.android.kt:224)
E/AndroidRuntime( 6131): at androidx.compose.ui.platform.WindowRecomposer_androidKt.getWindowRecomposer(WindowRecomposer.android.kt:299)
E/AndroidRuntime( 6131): at androidx.compose.ui.platform.AbstractComposeView.resolveParentCompositionContext(ComposeView.android.kt:242)
E/AndroidRuntime( 6131): at androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated(ComposeView.android.kt:249)
E/AndroidRuntime( 6131): at androidx.compose.ui.platform.AbstractComposeView.createComposition(ComposeView.android.kt:194)
E/AndroidRuntime( 6131): at androidx.compose.ui.platform.ComposeView.setContent(ComposeView.android.kt:420)
E/AndroidRuntime( 6131): at io.intercom.android.sdk.m5.notification.InAppNotificationCardKt.addTicketHeaderToCompose(InAppNotificationCard.kt:55)
E/AndroidRuntime( 6131): at io.intercom.android.sdk.overlay.ChatNotification.populateViewsWithData(ChatNotification.java:111)
E/AndroidRuntime( 6131): at io.intercom.android.sdk.overlay.ChatNotification.display(ChatNotification.java:71)
E/AndroidRuntime( 6131): at io.intercom.android.sdk.overlay.InAppNotificationPresenter.addNewNotifications(InAppNotificationPresenter.java:184)
E/AndroidRuntime( 6131): at io.intercom.android.sdk.overlay.InAppNotificationPresenter.displayNotificationsAfterAttach(InAppNotificationPresenter.java:90)
E/AndroidRuntime( 6131): at io.intercom.android.sdk.overlay.InAppNotificationPresenter$1.run(InAppNotificationPresenter.java:79)
E/AndroidRuntime( 6131): at io.intercom.android.sdk.utilities.ViewUtils$1.onGlobalLayout(ViewUtils.java:30)
E/AndroidRuntime( 6131): at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1061)
E/AndroidRuntime( 6131): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3269)
E/AndroidRuntime( 6131): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2182)
E/AndroidRuntime( 6131): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8730)
E/AndroidRuntime( 6131): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1352)
E/AndroidRuntime( 6131): at android.view.Choreographer.doCallbacks(Choreographer.java:1149)
E/AndroidRuntime( 6131): at android.view.Choreographer.doFrame(Choreographer.java:1049)
E/AndroidRuntime( 6131): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1333)
E/AndroidRuntime( 6131): at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime( 6131): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 6131): at android.os.Looper.loop(Looper.java:233)
E/AndroidRuntime( 6131): at android.app.ActivityThread.main(ActivityThread.java:8010)
E/AndroidRuntime( 6131): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 6131): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
E/AndroidRuntime( 6131): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Either there’s a bug in the latest native sdk or there was a change that is currently not handled by the Flutter plugin, I can check tomorrow the native release notes just in case there was something missing
Some API methods are deprecated in v14 https://developers.intercom.com/installing-intercom/docs/migrating-to-14-0-0-android. There is no change in the notification setup or handling. https://developers.intercom.com/installing-intercom/docs/push-notifications-android#step-6-using-intercom-with-other-fcm-setups-optional
I have already reported this issue to Intercom.
@deepak786 and @Zazo032 As I checked that Intercom released the 14.0.1 Version Are you guys updating that version and checked this crash was resolved in that version or not?
Checkout intercom github link==> https://github.com/intercom/intercom-android
https://github.com/intercom/intercom-android/blob/master/README.md
@devalp-pro Nothing is mentioned there about this bug in version 14.0.1.
The same crash appears even with SDK version 14.0.1
Hi @deepak786
Can you check if this Integration it's done in our SDK or not?
Push Notification Apps targeting Android 13 should request a runtime permission to enable notifications. Add the following code to request permission.
registerForActivityResult( ActivityResultContracts.RequestPermission() ) { if (isGranted) { // Permission is granted. Continue the action or workflow in your // app. } else { // Explain to the user that the feature is unavailable because the // features requires a permission that the user has denied. At the // same time, respect the user's decision. Don't link to system // settings in an effort to convince the user to change their // decision. } }
Update from Intercom support:
Hi Deepak! I do have something to share but we don't have a fix as yet. The engineer said that he was able to reproduce the crash and that it only happens when Intercom is integrated via the flutter wrapper, not when integrated natively.
As it doesn’t seem like a straightforward fix, we are opening an issue for it and will let you know once we hear back from the team. I'll circle back to you later this week once I know a rough timeframe of how long this will take the team to address 👍
Hi @deepak786 ,
We are testing the intercom on android and iOS. In iOS platform also got problems with notifications.
Testcase for iOS and Android as below
iOS
Android
@deepak786 Thanks for following up with intercom and getting them on the issue. Hopefully they fix it in native soon so you can update.
I have held back on my other android apps updates to 14 for this exact reason. The last time they did a big update they had things breaking after they did a backend change and took forever to fix the native sdk.
@deepak786 Thanks for following up with intercom and getting them on the issue. Hopefully they fix it in native soon so you can update.
I have held back on my other android apps updates to 14 for this exact reason. The last time they did a big update they had things breaking after they did a backend change and took forever to fix the native sdk.
How can i use older sdk ?
@saged87 Use intercom_flutter: 7.5.0
I have heard back from Intercom
Me again Deepak! I’ve heard back from our team and can confirm that we’re adding this issue to our backlog to be fixed!
For greater context, our product team prioritizes bugs based on the severity of the issue and how widespread of an experience it is with customers. To provide insight on expectations, issues like this may not be actioned for some months. That timeline is based on the team's current existing log of issues and upcoming feature releases which is subject to change.
Given the long-term nature of the work to be done here, I’m going to close this conversation with you for now, but I will reopen the case and send an update when the team moves forward with a fix 👍
I appreciate you taking the time to surface this issue with our team and you can rest assured I’ll take ownership from here!
This issue is not prioritized. I will suggest everyone report this issue to Intercom including this issue link.
@deepak786 Could you drop us a link to the issue you have with them. Or explain how we could log one ourselves. I have not been able to find how 😵💫
Upgrading manually to 14.0.3 does not fix that
@deepak786 Just got an update from our product team:
@aparnabalasubramanian Thanks for the update. We are updating the docs regarding this.
Unfortunately changing to FlutterFragmentActivity breaks different plugin that uses platform views
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: cameraView
at io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(PlatformViewsController.java:175)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:109)
at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
, null, null). Error thrown Zone error.
at StandardMethodCodec.decodeEnvelope(message_codecs.dart:653)
at MethodChannel._invokeMethod(platform_channel.dart:296)
at ExpensiveAndroidViewController._sendCreateMessage(platform_views.dart:1023)
at AndroidViewController.create(platform_views.dart:792)
Already discussing this with the Intercom support.
Update from Intercom Support:
Okay, so I heard back from the team who tell me that as the problem is a Flutter problem and not an Intercom or Android SDK problem, we won't be able to fix this issue.
We don't officially support Flutter but we'll always take a first look to see if there's something we can do. In this case however, it's not something we can fix Deepak.
@orestesgaolin By using the FlutterFragmentActivity
, Is the crash only with PlatformViews such as a camera, or video_player?
I'm curious to know how developers managed to use the FlutterFragmentActivity
along with PlatformViews. Because intercom_flutter
is not the package that requires now the FlutterFragmentActvity
. The local_auth package also requires to use of FlutterFragmentActivity
.
I'll look into that and will try to give you more insight if FragmentActivity is a problem at all
@orestesgaolin
Maybe you need to override the configureFlutterEngine
in MainActivity.kt
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterFragmentActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
Please also share the sample to reproduce the above issue.
When a new user registers and tries to access the intercom it's registered the first time and displays the chat window perfectly. But, When the user starts sending messages it's worked after that user closes the application. And the user gets notified by the intercom user and a push notification got on clicked push notification application getting crashed. After this crash user never opens messanger screen. The user got this crashed every time.
My Code
Exception