Skip to content

Commit 99c41d7

Browse files
authored
Fixing BadTokenException while showing FIAM (#2402)
Fixing BadTokenException while showing FIAM. Related Bug : #2107 This is a possible fix as the BadTokenException usually happens when we try to add/show new views with a finishing activity context.
1 parent 29e73e5 commit 99c41d7

File tree

1 file changed

+5
-0
lines changed
  • firebase-inappmessaging-display/src/main/java/com/google/firebase/inappmessaging/display/internal

1 file changed

+5
-0
lines changed

firebase-inappmessaging-display/src/main/java/com/google/firebase/inappmessaging/display/internal/FiamWindowManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public void show(@NonNull final BindingWrapper bindingWrapper, @NonNull Activity
5454
return;
5555
}
5656

57+
if (activity.isFinishing()) {
58+
Logging.loge("Activity is finishing or does not have valid window token. Cannot show FIAM.");
59+
return;
60+
}
61+
5762
InAppMessageLayoutConfig config = bindingWrapper.getConfig();
5863
final WindowManager.LayoutParams layoutParams = getLayoutParams(config, activity);
5964

0 commit comments

Comments
 (0)