Android-RateThisApp


Source link: https://github.com/kobakei/Android-RateThisApp

Android-RateThisApp

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

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

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]

Resources

A messaging library for Android.

A cool customizable loading animation with Dots.

A simple and easy-to-use scroll number widget.

Simple implementations of a EditText widgets, which can help to visualise inputted text. Classes are inherited from AppCompatEditText.

FSquaDRA is a tool for detection of repackaged Android applications. The approach is based on the idea that repackaged applications want to maintain "look and feel" of the originals.

MultiSlider is multifunctional and multi thumb custom view component for Android. It Can be used as a normal Android seekbar, a range bar and multi-thumb bar. MultiSlider is extremely easy to use while still very flexible and customizable.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes