Android library to show "Rate this app" dialog

Overview

Android-RateThisApp

Build Status Download Android Arsenal

Android-RateThisApp is an library to show "Rate this app" dialog.

Screen shot

The library monitors the following status

  • How many times is the app launched
  • How long days does it take from the app installation

and show a dialog to engage users to rate the app in Google Play.

Getting Started

Dependency

dependencies {
    compile 'io.github.kobakei:ratethisapp:x.y.z'
}

x.y.z is Download

NOTICE: From 1.0.0, group ID has been changed from com.kobakei to io.github.kobakei.

Basic usage

Call RateThisApp.onCreate(Context) and RateThisApp.showRateDialogIfNeeded(Context) in your launcher activity's onCreate() method.

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

    // Monitor launch times and interval from installation
    RateThisApp.onCreate(this);
    // If the condition is satisfied, "Rate this app" dialog will be shown
    RateThisApp.showRateDialogIfNeeded(this);
}

That's all! You can see "Rate this app" dialog at an appropriate timing.

Advanced usages

Custom condition

In default, the dialog will be shown when any of the following conditions is satisfied.

  • App is launched more than 10 times
  • App is launched more than 7 days later than installation.

If you want to use your own condition, please call RateThisApp.init(Configuration) in your Application or launcher activity onCreate method.

// Custom condition: 3 days and 5 launches
RateThisApp.Config config = new RateThisApp.Config(3, 5);
RateThisApp.init(config);

Custom strings

You can override title, message and button labels.

RateThisApp.Config config = new RateThisApp.Config();
config.setTitle(R.string.my_own_title);
config.setMessage(R.string.my_own_message);
config.setYesButtonText(R.string.my_own_rate);
config.setNoButtonText(R.string.my_own_thanks);
config.setCancelButtonText(R.string.my_own_cancel);
RateThisApp.init(config);

Custom url

In default, rate button navigates to the application page on Google Play. You can override this url as below.

RateThisApp.Config config = new RateThisApp.Config();
config.setUrl("http://www.example.com");
RateThisApp.init(config);

Opt out from your code

If you want to stop showing the rate dialog, use this method in your code.

RateThisApp.stopRateDialog(this);

Callback

You can receive yes/no/cancel button click events.

RateThisApp.setCallback(new RateThisApp.Callback() {
    @Override
    public void onYesClicked() {
        Toast.makeText(MainActivity.this, "Yes event", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onNoClicked() {
        Toast.makeText(MainActivity.this, "No event", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onCancelClicked() {
        Toast.makeText(MainActivity.this, "Cancel event", Toast.LENGTH_SHORT).show();
    }
});

Contribute this project

If you want to contribute this project, please send pull request. In present, I need contributors who can translate resources from English/Japanese into other languages.

License

Copyright 2013-2017 Keisuke Kobayashi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Author

Keisuke Kobayashi - [email protected]

Comments
  • Update build dependencies

    Update build dependencies

    This updates Gradle wrapper to 2.14.1 and all Android deps to 24. [UPDATE See below: PR now contains more recent dependencies] [UPDATE 2] PR now includes latest Gradle wrapper 3.3 and latest Android build tools.

    opened by friederbluemle 6
  • Missing Title and Message on Android Marshmallow

    Missing Title and Message on Android Marshmallow

    Hi, first of all, thank you so much for creating this library. As I tried on Android Marshmallow, the title and message are missing. I see in RateThisApp.java:showRateDialog(), it still uses AlertDialog which uses a different constructor with theme for Android Lollilop and Marshmallow. As the result, I change the code (as described on here) and it works like a charm. So, I hope it will be fixed on the next release.

    *Sorry for my English. :dancers:

    opened by damai007 3
  • 0.0.3 not available from Maven

    0.0.3 not available from Maven

    Maybe it's too early but it doesn't look like the latest release has made it to the Maven central repo yet.

    http://javalibs.com/artifact/com.kobakei/ratethisapp

    opened by oseparovic 3
  • Update project

    Update project

    Multiple project updates, as a continuation to #54 All dependencies are at the latest version now, the project builds cleanly with no Lint errors/warnings.

    Please NO GitHub rebase/squash merges. If you'd like me to combine some or all of the commits, please let me know, and I will update my branch. Thank you.

    opened by friederbluemle 2
  • Unable to add library

    Unable to add library

    I tried to add library but it gives error. Have a look at the build gradle

    build.gralde(project-level) // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {
        repositories {
            jcenter()
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.0'
            classpath 'com.novoda:bintray-release:0.3.4'
        }
    }
    
    allprojects {
        repositories {
            jcenter()
            mavenCentral()
        }
    
    }
    
    

    build.gradle(app level)

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.2"
    
        defaultConfig {
            applicationId "xxx.xxxx.xxxxxx"
            minSdkVersion 9
            targetSdkVersion 25
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    }
    
    dependencies {
        compile 'com.google.android.gms:play-services-ads:8.1.0'
        compile 'com.android.support:support-v4:25.2.0'
        compile 'io.github.kobakei:ratethisapp:x.y.z'
        compile 'com.android.support:appcompat-v7:25.2.0'
    }
    
    opened by meet2011 2
  • Use true install time

    Use true install time

    Instead of assuming just installed, get the install date/time from the PackageManager. This makes the app ask for rating to old users as soon as they launch.

    opened by RandomShaper 2
  • Set mAskLaterDate in storeAskLaterDate

    Set mAskLaterDate in storeAskLaterDate

    Fixes an issue where:

    1. dialog is shown;
    2. user presses "neutral" button;
    3. immediately call shouldShowRateDialog and get true.

    This affects me because I'm not showing the dialog in onCreate (which is when settings are loaded). I call showRateDialogIfNeeded during the lifetime of my activity, and if the user presses "neutral" the dialog is show again and again until the activity is recreated and settings reloaded.

    opened by ncruces 1
  • Readme suggests onStart be called in Activity onStart which may be misleading

    Readme suggests onStart be called in Activity onStart which may be misleading

    From what I can tell the onStart life-cycle method is fired every time an AppCompatActivity becomes visible again. Doesn't this mean calling RateThisApp.onStart(this); in protected void onStart() could result in the startup counter incrementing multiple times in one user session? In my applications the MainActivity represents a home page and a user can easily navigate away and come back again 10-20 times in a single session.

    If my understanding above is correct I would recommend you suggest RateThisApp.onStart(this); be called in the launcher Activity's onCreate method instead as this should persist for the duration of the user's session.

    opened by oseparovic 1
  • You need to use a Theme.AppCompat theme (or descendant) with this activity

    You need to use a Theme.AppCompat theme (or descendant) with this activity

    I was having the following error when I tried using the code in an Activity:

    You need to use a Theme.AppCompat theme (or descendant) with this activity

    This is because in my AndroidManifest.xml I'm using the following theme: android:theme="@android:style/Theme.NoTitleBar"

    Changing the above to the below for the Activity that shows the RateApp dialog fixed this for me. android:theme="@style/Theme.AppCompat.NoActionBar"

    I got this solution from the below article: http://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity

    opened by mlayton20 1
  • mOptOut never set to true

    mOptOut never set to true

    Hi,

    I think that you should set mOptOut property inside setOptOut method. ATM when i choose "never" and call showRateDialogIfNeeded in the same session, dialog appears again.

    bug 
    opened by Spavacz 1
  • ability to manually add dialog title and message

    ability to manually add dialog title and message

    I have used this library in almost all of my apps and I change the title and the message everytime in the library to suit my needs, so I thought it should have some method to do so.

    opened by girish3 1
  • Not uploading to Play Store if compiled with bundle instead of apk

    Not uploading to Play Store if compiled with bundle instead of apk

    Hi, Really great API, gratz!

    Just one thing, when we try to upload our app on Play Store compile with bundle (app-release.aab) instead of apk, Play Console throws and error saying "language not recognized : gr".

    opened by brunodmn 0
Owner
Keisuke Kobayashi
Happy Hacking!
Keisuke Kobayashi
Make your native android Dialog Fancy and Gify. A library that takes the standard Android Dialog to the next level with a variety of styling options and Gif's. Style your dialog from code.

FancyGifDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ...

Shashank Singhal 522 Jan 2, 2023
Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.sv

Abdullah Alhazmy 73 Nov 29, 2022
ionalert 1.3 1.6 Java Sweetalert, Dialog, Alert Dialog

ionalert - Android Alert Dialog A beautiful design Android Alert Dialog, alternative of Sweet Alert Dialog based on KAlertDialog using MaterialCompone

Excel Dwi Oktavianto 23 Sep 17, 2022
Alert Dialog - You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment.

We show a warning message (Alert Dialog) to the user in many parts of our applications. You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment. Thanks to this extension, you can create a Dialog and call it in the Activity or Fragment you want and customize the component you want.

Gökmen Bayram 0 Jan 9, 2022
A simple library to show custom dialog with animation in android

SmartDialog A simple library to show custom dialog in android Step 1. Add the JitPack repository to your build file allprojects { repositories {

claudysoft 9 Aug 18, 2022
Extremely useful library to validate EditText inputs whether by using just the validator for your custom view or using library's extremely resizable & customisable dialog

Extremely useful library for validating EditText inputs whether by using just the validator (OtpinVerification) for your custom view or using library's extremely resizable & customisable dialog (OtpinDialogCreator)

Ehma Ugbogo 17 Oct 25, 2022
Android library that allows applications to add dialog-based slider widgets to their settings

Android Slider Preference Library Overview Slider represents a float between 0.0 and 1.0 Access with SliderPreference.getValue() or SharedPreferences.

Jay Petacat 135 Nov 29, 2022
An Android library for displaying a dialog where it presents new features in the app.

WhatIsNewDialog What is new dialog for Android is used for presenting new features in the the app. It can be used in the activity starts, from menu or

NonZeroApps 22 Aug 23, 2022
An beautiful and easy to use dialog library for Android

An beautiful and easy to use dialog library for Android

ShouHeng 22 Nov 8, 2022
CuteDialog- Android Custom Material Dialog Library

A Custom Material Design Dialog Library for Android Purpose CuteDialog is a Highly Customizable Material Design Android Library. CuteDialog allows dev

CuteLibs - Smart & Beautiful Android Libraries 7 Dec 7, 2022
AlertDialog for Android, a beautiful and material alert dialog to use in your android app.

AlertDialog for Android, a beautiful and material alert dialog to use in your android app. Older verion of this library has been removed

Akshay Masram 124 Dec 28, 2022
Advanced dialog solution for android

DialogPlus Simple and advanced dialog solution. Uses normal view as dialog Provides expandable option Multiple positioning Built-in options for easy i

Orhan Obut 5k Dec 29, 2022
SweetAlert for Android, a beautiful and clever alert dialog

Sweet Alert Dialog SweetAlert for Android, a beautiful and clever alert dialog 中文版 Inspired by JavaScript SweetAlert Demo Download ScreenShot Setup Th

书呆子 7.3k Dec 30, 2022
An Android Dialog Lib simplify customization.

FlycoDialog-Master 中文版 An Android Dialog Lib simplify customization. Supprot 2.2+. Features [Built-in Dialog, convenient to use](#Built-in Dialog) [Ab

Flyco 2.3k Dec 8, 2022
[Deprecated] This project can make it easy to theme and custom Android's dialog. Also provides Holo and Material themes for old devices.

Deprecated Please use android.support.v7.app.AlertDialog of support-v7. AlertDialogPro Why AlertDialogPro? Theming Android's AlertDialog is not an eas

Feng Dai 468 Nov 10, 2022
A simple file/ directory picker dialog for android

FileListerDialog FileListerDialog helps you to list and pick file/directory. Library is built for Android Getting Started Installing To use this libra

Yogesh S 446 Jan 7, 2023
a quick custom android dialog project

QustomDialog Qustom helps you make quick custom dialogs for Android. All this is, for the time being, is a way to make it easy to achieve the Holo loo

Daniel Smith 183 Nov 20, 2022
AlertDialog - Explain about Alert Dialog in Android

AndroidTemplate I got a problem to create Android project with Java 11 and anoth

Monthira Chayabanjonglerd 1 Feb 13, 2022
An easy to use, yet very customizable search dialog

search-dialog An awesome and customizable search dialog with built-in search options. Usage First add jitpack to your projects build.gradle file allpr

Mad Mirrajabi 518 Dec 15, 2022