Android-Rate is a library to help you promote your android app by prompting users to rate the app after using it for a few days.
you can download from maven central. current version is 0.2.1.
dependencies {
compile 'com.github.hotchemi:android-rate:{latest.version}'
}
Please try to move the sample module.
Android-rate provides class methods to configure its behavior.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AppRate.setInstallDays(0) // default 10, 0 means install day.
.setLaunchTimes(3) // default 10
.setRemindInterval(2) // default 1
.setShowNeutralButton(true) // default true
.setDebug(false) // default false
.setOnClickButtonListener(new OnClickButtonListener() { // callback listener.
@Override
public void onClickButton(int which) {
Log.d(MainActivity.class.getName(), Integer.toString(which));
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
// nothing to do
}
})
.monitor(this);
// Show a dialog if meets conditions
AppRate.showRateDialogIfMeetsConditions(this);
}
The default conditions to show rate dialog is as below:
- App is launched more than 10 days later than installation. Chenge via
AppRate.setInstallDays(int)
. - App is launched more than 10 times. Change via
AppRate.setLaunchTimes(int)
. - App is launched more than 2 days after neutral button clicked. Change via
AppRate.setRemindInterval(int)
. - App shows neutral dialog(Remind me later) by default. Change via
setShowNeutralButton(boolean)
. - To specify the callback when the button is pressed. The same value as the second argument of
DialogInterface.OnClickListener#onClick
will be passed in the argument ofonClickButton
. - Setting
AppRate.setDebug(boolean)
will ensure that the rating request is shown each time the app is launched. This feature is only development!.
When you want to track significant events, write code as below.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AppRate.setEventTimes(2).monitor(this);
}
@Override
public void onClick() {
AppRate.passSignificantEvent(this); // when user pass this line for the third time, dialog appears.
}
When you want to show the dialog again, call AppRate.clearAgreeShowDialog(Context)
.
AppRate.clearAgreeShowDialog(this);
call AppRate.showDialog(Context)
.
AppRate.showDialog(this);
If you want to use your own dialog labels, override string xml resources on your application.
<resources>
<string name="rate_dialog_title">Rate this app</string>
<string name="rate_dialog_message">If you enjoy playing this app, would you mind taking a moment to rate it? It won\'t take more than a minute. Thanks for your support!</string>
<string name="rate_dialog_ok">Rate It Now</string>
<string name="rate_dialog_cancel">Remind Me Later</string>
<string name="rate_dialog_no">No, Thanks</string>
</resources>
Android-Rate currently supports the following languages:
- English
- Spanish
- French
- Chinese
- Korean
- Japanese
- Vietnamese
- Polish
- Czech
Supports Android 2.1 or greater.
$ ./gradlew connectedCheck
- 2014/07/02 0.2.1 release.
- 2014/06/20 0.2.0 release.
- 2014/06/19 0.1.3 release.
- 2014/06/16 0.1.2 release.
- 2014/06/15 0.1.1 release.
- 2014/05/25 0.1.0 release.
- 2014/04/13 0.0.6 release.
- 2014/04/12 0.0.5 release.
- 2014/04/07 0.0.4 release.
- 2014/02/13 0.0.3 release.
- 2014/02/12 0.0.2 release.
- 2014/02/11 0.0.1 release.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request