From 21f8388f6ac75fdc96298375eec35cb64fa81502 Mon Sep 17 00:00:00 2001 From: Nickolay Toropov Date: Thu, 24 May 2018 13:52:40 +0300 Subject: [PATCH] Fixed app crash caused by BadTokenException. (#1287) --- .../main/java/com/microsoft/codepush/react/CodePushDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java b/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java index 81e643f..e4d39cd 100644 --- a/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +++ b/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java @@ -20,7 +20,7 @@ public class CodePushDialog extends ReactContextBaseJavaModule{ public void showDialog(final String title, final String message, final String button1Text, final String button2Text, final Callback successCallback, Callback errorCallback) { Activity currentActivity = getCurrentActivity(); - if (currentActivity == null) { + if (currentActivity == null || currentActivity.isFinishing()) { // If getCurrentActivity is null, it could be because the app is backgrounded, // so we show the dialog when the app resumes) getReactApplicationContext().addLifecycleEventListener(new LifecycleEventListener() {