Skip to content

Commit

Permalink
Stop crashing on emulated devices (#19)
Browse files Browse the repository at this point in the history
* Stop crashing on emulated devices
* Fix logging error
  • Loading branch information
TaylorDale authored Dec 31, 2020
1 parent 7e979bd commit 5b96fb6
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,19 @@ public void show() {
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
// We can get the ReviewInfo object
ReviewInfo reviewInfo = task.getResult();
Task<Void> flow = manager.launchReviewFlow(getCurrentActivity(), reviewInfo);

flow.addOnCompleteListener(taski -> {
// The flow has finished. The API does not indicate whether the user
// reviewed or not, or even whether the review dialog was shown. Thus, no
// matter the result, we continue our app flow.
Log.e("Review isSuccessful", "" + taski.isSuccessful());
});
try {
ReviewInfo reviewInfo = task.getResult();
Task<Void> flow = manager.launchReviewFlow(getCurrentActivity(), reviewInfo);

flow.addOnCompleteListener(taski -> {
// The flow has finished. The API does not indicate whether the user
// reviewed or not, or even whether the review dialog was shown. Thus, no
// matter the result, we continue our app flow.
Log.e("Review isSuccessful", "" + taski.isSuccessful());
});
} catch (Exception e) {
Log.e("Review Error", "getResult may have thrown an exception. This is likely an emulated device.");
}
} else {
Log.e("Review Error", task.getResult().toString());
}
Expand Down

0 comments on commit 5b96fb6

Please sign in to comment.