RateMyApp icon indicating copy to clipboard operation
RateMyApp copied to clipboard

Cannot showRateDialog()

Open hoangphuc1103 opened this issue 1 year ago • 3 comments

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 avatar Aug 07 '24 09:08 hoangphuc1103

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.

Skyost avatar Aug 09 '24 18:08 Skyost

Hey @Skyost, I think it might be related to #64

chungxon avatar Apr 23 '25 07:04 chungxon

Yes, it's possible. But sadly, as I stated on #64, there's really not much we can do...

Skyost avatar Apr 27 '25 14:04 Skyost