@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); prefManager = PreferenceManager.getDefaultSharedPreferences(this); onFirstInstall(); onFirstUpdate(); handleIntent(getIntent()); if (Utils.tempBool && getIntent().getStringExtra("uri") != null) uri = Uri.parse(getIntent().getStringExtra("uri")); // Custom condition: 5 days and 5 launches RateThisApp.Config config = new RateThisApp.Config(5, 5); RateThisApp.init(config); RateThisApp.onCreate(this); RateThisApp.showRateDialogIfNeeded(this); }
RateThisApp.init(new RateThisApp.Config(3, 5));
@Test public void shouldRateDialogIfNeeded_LaunchTimeIsCorrect() { Context context = RuntimeEnvironment.application.getApplicationContext(); RateThisApp.init(new RateThisApp.Config(1, 3)); RateThisApp.onStart(context); Assert.assertFalse(RateThisApp.shouldShowRateDialog()); RateThisApp.onStart(context); Assert.assertFalse(RateThisApp.shouldShowRateDialog()); RateThisApp.onStart(context); Assert.assertTrue(RateThisApp.shouldShowRateDialog()); RateThisApp.onStart(context); Assert.assertTrue(RateThisApp.shouldShowRateDialog()); }