Skip to content

Commit

Permalink
[in_app_review] Add play-services-base dependency to Android.
Browse files Browse the repository at this point in the history
Other hybrid implementations of the In-App Reviews API use this dependency and the absence of it may be causing silent failures for apps or devices that do not transitively include the library.
  • Loading branch information
britannio committed Sep 16, 2023
1 parent 7b47371 commit d258bcb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions in_app_review/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ android {
dependencies {
// Release notes: https://developer.android.com/reference/com/google/android/play/core/release-notes-in_app_reviews
implementation 'com.google.android.play:review:2.0.1'
// Release notes: https://developers.google.com/android/guides/releases
implementation 'com.google.android.gms:play-services-base:18.2.0'


}
}

3 comments on commit d258bcb

@davidmartos96
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@britannio I found out why other hybrid implementations add this dependency.
For instance for React Native, take a look st the commit where they introduced it.
MinaSamir11/react-native-in-app-review@79890b5

They use it to check if Google Services is available or not. I'm not sure if that's needed or if it is redundant. The In App Review API already tells you when it's available or not 🤷‍♂️

@britannio
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good find, thank you. Maybe there's a difference between the play store being installed (I check for this) and play services being available (I do not check for this but this play-services-base library seems to allow for this). The difference would look like this.

    private boolean isPlayStoreInstalled() {
        try {
            context.getPackageManager().getPackageInfo("com.android.vending", 0);
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }

+     GoogleApiAvailability availability = GoogleApiAvailability.getInstance();
+       if (availability.isGooglePlayServicesAvailable(context) != ConnectionResult.SUCCESS) {
+           return false;
+       }

        return true;
    }

@britannio
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately though, it seems like if requestReview() didn't work before this commit (although I cannot reproduce), it will continue to fail.

Please sign in to comment.