From d0647993192f67225b736c0fc2177920b78968eb Mon Sep 17 00:00:00 2001 From: ogard Date: Mon, 11 Jan 2021 11:40:58 +0100 Subject: [PATCH] Fix crash on PlayStore disabled --- .../react_native_in_app_review/AppReviewModule.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/ibits/react_native_in_app_review/AppReviewModule.java b/android/src/main/java/com/ibits/react_native_in_app_review/AppReviewModule.java index 1094c2c..1bbb6c8 100755 --- a/android/src/main/java/com/ibits/react_native_in_app_review/AppReviewModule.java +++ b/android/src/main/java/com/ibits/react_native_in_app_review/AppReviewModule.java @@ -31,7 +31,7 @@ public String getName() { @ReactMethod public void show() { - if(isPlayStoreInstalled(getReactApplicationContext())) { + if (isPlayStoreInstalled(getReactApplicationContext())) { ReviewManager manager = ReviewManagerFactory.create(getReactApplicationContext()); Task request = manager.requestReviewFlow(); Log.e("isPlayStoreInstalled",isPlayStoreInstalled(getReactApplicationContext())+""); @@ -50,11 +50,17 @@ public void show() { }); } else { - Log.e("Review Error", task.getResult().toString()); + String taskErrorMessage = ""; + try { + taskErrorMessage = task.getResult().toString(); + } catch (Exception e) { + taskErrorMessage = e.getMessage(); + } + Log.e("Review Error", taskErrorMessage); } }); - }else{ + } else { Log.e("isPlayStoreInstalled",isPlayStoreInstalled(getReactApplicationContext())+""); } }