Coder Social home page Coder Social logo

bryant1410 / android-rate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hotchemi/android-rate

0.0 2.0 0.0 688 KB

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.

Home Page: http://hotchemi.github.io/Android-Rate

License: MIT License

Java 100.00%

android-rate's Introduction

Android-Rate

Build Status Android Arsenal

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.

screen shot

Getting Started

Maven Badges

You can download from maven central.

dependencies {
  compile 'com.github.hotchemi:android-rate:{$latest.version}'
}

Sample

Please try to move the sample.

How to use

javadoc.io

Configuration

Android-Rate provides methods to configure its behavior.

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  AppRate.with(this)
      .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));
          }
      })
      .monitor();

  // Show a dialog if meets conditions
  AppRate.showRateDialogIfMeetsConditions(this);
}

The default conditions to show rate dialog is as below:

  1. App is launched more than 10 days later than installation. Change via AppRate#setInstallDays(int).
  2. App is launched more than 10 times. Change via AppRate#setLaunchTimes(int).
  3. App is launched more than 2 days after neutral button clicked. Change via AppRate#setRemindInterval(int).
  4. App shows neutral dialog(Remind me later) by default. Change via setShowNeutralButton(boolean).
  5. 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 of onClickButton.
  6. Setting AppRate#setDebug(boolean) will ensure that the rating request is shown each time the app is launched. This feature is only development!.

Event Tracking

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.with(this).setEventTimes(2).monitor();
}

@Override
public void onClick() {
  AppRate.passSignificantEvent(this); // when user pass this line for the third time, dialog appears.
}

Clear show dialog flag

When you want to show the dialog again, call AppRate#clearAgreeShowDialog().

AppRate.with(this).clearAgreeShowDialog();

When the button presses on

call AppRate#showDialog(Activity).

AppRate.with(this).showDialog(this);

Set custom view

call AppRate#setView(View).

LayoutInflater inflater = (LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.custom_dialog, (ViewGroup)findViewById(R.id.layout_root));
AppRate.with(this).setView(view).monitor();

Custom dialog

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>

Localization

Android-Rate currently supports the following languages:

  • English
  • Spanish
  • French
  • Chinese
  • Korean
  • Japanese
  • Vietnamese
  • Polish
  • Czech
  • Russian
  • Ukrainian
  • Hebrew
  • Portuguese
  • Turkish

Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

android-rate's People

Contributors

bersh avatar amitkot avatar agap avatar nein37 avatar w3z315 avatar dyouyang avatar xiprox avatar isso avatar joelbrito avatar hoang8f avatar igzmartarodriguez avatar androhi avatar tomasvalenta avatar maarekj avatar pkosiec avatar

Watchers

Santiago Castro avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.