Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot showRateDialog() #147

Open
hoangphuc1103 opened this issue Aug 7, 2024 · 1 comment
Open

Cannot showRateDialog() #147

hoangphuc1103 opened this issue Aug 7, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@hoangphuc1103
Copy link

hoangphuc1103 commented Aug 7, 2024

Describe the bug
I'm running the app on Android Simulator (Pixel_API_31) and having an issue that the Rating Dialog cannot be displayed

I/flutter ( 9402): │  Are all conditions met to show dialog: Yes

I/PlayCore( 9402): UID: [10167]  PID: [9402] ReviewService : requestInAppReview (com.inspireui.fluxstore)
I/PlayCore( 9402): UID: [10167]  PID: [9402] ReviewService : Initiate binding to the service.
D/EGL_emulation( 9402): app_time_stats: avg=347725.22ms min=64.36ms max=695386.12ms count=2
I/PlayCore( 9402): UID: [10167]  PID: [9402] ReviewService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.inappreviewservice.InAppReviewService})
I/PlayCore( 9402): UID: [10167]  PID: [9402] ReviewService : linkToDeath
I/PlayCore( 9402): UID: [10167]  PID: [9402] OnRequestInstallCallback : onGetLaunchReviewFlowInfo
I/PlayCore( 9402): UID: [10167]  PID: [9402] ReviewService : Unbind from service.

SourceCode

mixin RateMyAppMixin<T extends StatefulWidget> on State<T> {
  final _rateMyApp = RateMyApp(
    // rate app on store
    minDays: 0,
    minLaunches: 1,
    remindDays: 0,
    remindLaunches: 0,
    googlePlayIdentifier: 'com.inspireui.fluxstore',
    appStoreIdentifier: '1469772800',
  );

  void showRateMyApp() async {
    await _rateMyApp.init().then((_) {
      if (kDebugMode) {
        printLog(
            'Are all conditions met to show dialog: ${_rateMyApp.shouldOpenDialog ? 'Yes' : 'No'}');
      }
      _rateMyApp.showRateDialog(
        context,
        title: S.of(context).rateTheApp,
        // The dialog title.
        message: S.of(context).rateThisAppDescription,
        // The dialog message.
        rateButton: S.of(context).rate.toUpperCase(),
        // The dialog 'rate' button text.
        noButton: S.of(context).noThanks.toUpperCase(),
        // The dialog 'no' button text.
        laterButton: S.of(context).maybeLater.toUpperCase(),
        // The dialog 'later' button text.
        listener: (button) {
          // The button click listener (useful if you want to cancel the click event).
          switch (button) {
            case RateMyAppDialogButton.rate:
              break;
            case RateMyAppDialogButton.later:
              break;
            case RateMyAppDialogButton.no:
              break;
          }

          return true; // Return false if you want to cancel the click event.
        },
        // Set to false if you want to show the native Apple app rating dialog on iOS.
        dialogStyle: const DialogStyle(),
        // Custom dialog styles.
        // Called when the user dismissed the dialog (either by taping outside or by pressing the 'back' button).
        // actionsBuilder: (_) => [], // This one allows you to use your own buttons.
      );
    });
  }

  /// Only use after show dashboard
  void showRatingOnOpen() async {
    if (mounted) {
      await _rateMyApp.init();

      if (isMobile && kAppRatingConfig.showOnOpen) {
        if (_rateMyApp.shouldOpenDialog) {
          await Future.delayed(const Duration(seconds: 1));
          showRateMyApp();
        }
      }
    }
  }
}
@hoangphuc1103 hoangphuc1103 added the bug Something isn't working label Aug 7, 2024
@hoangphuc1103 hoangphuc1103 changed the title Cannot show RateDiaLog Cannot showRateDialog() Aug 7, 2024
@Skyost
Copy link
Owner

Skyost commented Aug 9, 2024

It seems to be a problem with Play Core not showing the in-app review dialog. There are a lot of possible causes. Please see this answer : https://stackoverflow.com/a/65333746/3608831.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants