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

Dialog not showing up on Android #65

Closed
maxbeech opened this issue Aug 16, 2020 · 1 comment
Closed

Dialog not showing up on Android #65

maxbeech opened this issue Aug 16, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@maxbeech
Copy link

Describe the bug
Dialog showing up on iOS, but not on a physical Android device.

Expected behavior
Dialog should show.

Many thanks for your help!

Source code

import 'package:flutter/material.dart';
import 'package:rate_my_app/rate_my_app.dart';

RateMyApp rateMyApp = RateMyApp (
    preferencesPrefix: 'ratemyapp_',
    minDays: 0,
    minLaunches: 4,
    remindDays: 2,
    remindLaunches: 5
);

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(TestApp());
}

class TestApp extends StatefulWidget {
  @override
  _TestAppState createState() => _TestAppState();
}

class _TestAppState extends State<TestApp> {
  @override
  void initState() {
      super.initState();
      rateMyApp.init().then((_){
      if(rateMyApp.shouldOpenDialog){ //conditions check if user already rated the app
        rateMyApp.showStarRateDialog(
          context,
          title: 'How are you finding the app?',
          message: 'We REALLY want to hear your thoughts',
          actionsBuilder: (_, stars){
            return [ // Returns a list of actions (that will be shown at the bottom of the dialog).
              FlatButton(
                child: Text('OK'),
                onPressed: () async {
                  print('Thanks for the ' + (stars == null ? '0' : stars.round().toString()) + ' star(s) !');
                  if(stars != null && (stars == 4 || stars == 5)){
                    //if the user stars is equal to 4 or five
                    LaunchReview.launch();
                  } else {
// else you can redirect the user to a page in your app to tell you how you can make the app better

                  }
                  // You can handle the result as you want (for instance if the user puts 1 star then open your contact page, if he puts more then open the store page, etc...).
                  // This allows to mimic the behavior of the default "Rate" button. See "Advanced > Broadcasting events" for more information :
                  await rateMyApp.callEvent(RateMyAppEventType.rateButtonPressed);
                  Navigator.pop<RateMyAppDialogButton>(context, RateMyAppDialogButton.rate);
                },
              ),
            ];
          },
          dialogStyle: DialogStyle(
            titleAlign: TextAlign.center,
            messageAlign: TextAlign.center,
            messagePadding: EdgeInsets.only(bottom: 20.0),
          ),
          starRatingOptions: StarRatingOptions(),
          onDismissed: () => rateMyApp.callEvent(RateMyAppEventType.laterButtonPressed),
        );
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(),
        body: Center(child: Text('test')),
      ),
    );
  }
}

Console messages

  |   |   | I/PlayCore(21680): UID: [10307]  PID: [21680] ReviewService : requestInAppReview (com.test.testapp)
  |   |   | I/PlayCore(21680): UID: [10307]  PID: [21680] ReviewService : Initiate binding to the service.
  |   |   | I/PlayCore(21680): UID: [10307]  PID: [21680] ReviewService : ServiceConnectionImpl.onServiceConnected(ComponentInfo{com.android.vending/com.google.android.finsky.inappreviewservice.InAppReviewService})
  |   |   | I/PlayCore(21680): UID: [10307]  PID: [21680] ReviewService : linkToDeath
  |   |   | I/PlayCore(21680): UID: [10307]  PID: [21680] ReviewService : Unbind from service.
  |   |   | I/PlayCore(21680): UID: [10307]  PID: [21680] OnRequestInstallCallback : onGetLaunchReviewFlowInfo
  |   |   | I/HwPointEventFilter(21680): do not support AFT because of no config
@maxbeech maxbeech added the bug Something isn't working label Aug 16, 2020
@Skyost
Copy link
Owner

Skyost commented Aug 17, 2020

Duplicate of #64.

@Skyost Skyost closed this as completed Aug 17, 2020
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