Reputation: 3627
I added new feature in app for show in-app Messaging campaign. but when the splash is loading at that time its show campaign and splash screen will be disappear with-in few sec. so application throws an crashes.
Here is the crash log:
Fatal Exception: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
at android.view.ViewRootImpl.setView(ViewRootImpl.java:894)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:337)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:109)
at com.google.firebase.inappmessaging.display.internal.FiamWindowManager.show(Unknown Source)
at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay$5.onSuccess(Unknown Source)
at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay.loadNullableImage(Unknown Source)
at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay.inflateBinding(Unknown Source)
at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay.access$400(Unknown Source)
at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay$2.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7331)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
So how to prevent for stop showing in-app messaging campaign for specific activity?
Upvotes: 2
Views: 470
Reputation: 3627
After some research I solved my issue with my custom firebase event.
Just log your custom firebase event in your screen where you want your campaign dialog. and schedule your campaign with your custom event.
That's it.
Upvotes: 2