AppRater-Dialog


Source link: https://github.com/Lars3n95/AppRater-Dialog

AppRater-Dialog

An Android library providing the possibility to show a dialog, which asks the user to rate the app.

What can you do with this library?

You can show customized dialogs to the user. Here are some examples:



How to use this library?

Gradle

You can include the library via Gradle with the following dependency:

 compile 'com.kila.apprater_dialog.lars:apprater-dialog:1.0.5' 

Builder

This library has two Builders with which you can build the AppRater-dialog. Both have the method appLaunched(). Call this when you want the dialog to be shown (recommended: in onCreate()). Take a look at the examples below.

DefaultBuilder

With this Builder you can build the default dialog with text only. You can change the texts, you can choose which buttons should be displayed, you can change the texts of the buttons and you can choose when the dialog should be shown.

To create a default dialog use the DefaultBuilder constructor:

new AppRater.DefaultBuilder(Context context, String packageName);
 

The context should be this of an Activity. The packageName is necessary to redirected the user to the PlayStore.

To show the dialog (if all conditions are fulfilled) call appLaunched()

new AppRater.DefaultBuilder(Context context, String packageName).appLaunched();
 

This will build the dialog if all conditions are fullfilled. At this moment it will create an empty screen because there is no content you gave him.

If you just want to display default texts and buttons like in the third picture above use showDefault():

new AppRater.DefaultBuilder(this, "com.kila.addnotification.lars").showDefault().appLaunched();
 

With this settings the dialog will be shown if the following conditions are fulfilled: The app is installed for a minimum of 3 days and the app is launched for a minimum of 5 times. Furthermore the dialog will be shown every second launch if the user clicks Later. If the rate or never button is clicked once, the dialog will never be shown again. This cannot be changed with the API and it is not recommendet to change this.

Between the constructor and the appLaunched() you can customize the dialog. You have following possibilities:

  • change the number of days, the app has to be installed (default: 3 days) DEPRECATED use timeToWait() instead

    .daysToWait(int daysToWait) 
  • change the time, the app has to be installed (default: 3 days) (documentation for TimeUnit)

    .timeToWait(TimeUnit timeUnit, long timeToWait) 
  • change the number of launches, the app has to be launched (default: 5 launches)

    .timesToLaunch(int timesToLaunch) 
  • change the title (default: see pictures above)

    .title(String title) 
  • change the message (default: see pictures above)

    .message(String message) 
  • change the rate button's text (default: see pictures above)

    .rateButton(String rateButtonText) 
  • change the not now button's text (default: see pictures above)

    .notNowButton(String nowNowButtonText) 
  • change the never button's text (default: see pictures above)

    .neverButton(String neverButtonText) 
  • change the number of launches, the app has to be launched after a Later until the dialog is shown again (default: 2 launches)

    .timesToLaunchInterval(int timesToLaunchInterval) 
  • choose if the dialog should be cancelable (by clicking outside or clicking back button) (default: true)

    .isCancelable(boolean cancelable) 

Here is an example of how to create a customized dialog:

public class MainActivity extends AppCompatActivity {

@Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

new AppRater.DefaultBuilder(this, "com.kila.addnotification.lars")

  .showDefault()

  .timeToWait(TimeUnit.DAYS, 4)

  .timesToLaunch(3)

  .title("Rate Notify me")

  .notNowButton(null)

  .rateButton("I want to rate")

  .appLaunched();

setContentView(R.layout.activity_main);

  
}
 
}
 

First all settings are set to default. Then I overwrite some of them. I want to wait 4 days instead of 3, the app should be launched only 3 times instead of 5. Furthermore I want a different title, I don't want the notNowButton ( Later) to be displayed and I want to change the rateButton's text.

StarBuilder

With this Builder you can build the dialog with the stars. You can change the texts, you can choose which buttons should be displayed, you can choose when the dialog should be shown, you can choose the minimum number of stars which have to be selected to redirect to the PlayStore and you can choose if they can email you if the rating is not good enough.

Use the showDefault() again to show the default dialog displayed in the first picture above. Next to the things you can customize at the DefaultBuilder you can customize following things:

  • change the minimum number of selected stars. If the user gives a rating matching your minimum number of stars he will be redirected to the PlayStore (default is 3)

    .minimumNumberOfStars(int minimumNumberOfStars) (default: 3 stars) 
  • set an email address. If the user does not select enough stars he will be asked to send an email with suggestions (second picture above) if you set an email address. Without email address the dialog just will be dismissed if the rating is not high enough

    .email(String email) (default: null, the feedback dialog asking for suggestions will not be displayed) 

You only can use .minimumNumberOfStars() and .email after the constructor or showDefault(). It is not possible to set it after .title() or something. If you have a suggestion how to change this please tell me.

Here is an example of how to create a customized dialog:

public class MainActivity extends AppCompatActivity {

@Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

new AppRater.StarBuilder(this, "com.kila.addnotification.lars")

  .showDefault()

  .minimumNumberOfStars(4)

  .email("[email protected]")

  .appLaunched();

setContentView(R.layout.activity_main);

  
}
 
}
 

This time I am happy with the default settings. I just want the user to select a minimum of 4 stars before he gets redirected to the Play Store. Furthermore I set the email address so the dialog shown in the second picture above will be shown if the user only select 3 or less stars.

Orientation changes

If the orientation is changed the onCreate will be called again and so the AppRater will be called, too. If you only want the AppRater to be called on "real" app launches you have to check for savedInstanceState :


 @Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

if(savedInstanceState != null) {

new AppRater.StarBuilder(this, "com.kila.addnotification.lars")

 .showDefault()

 .minimumNumberOfStars(4)

 .email("[email protected]")

 .appLaunched();

}

setContentView(R.layout.activity_main);

  
}
 

Recommendation

Following things are highly recommendet to not annoy the user, which might produce negative ratings:

  • don't show the dialog immediately after install (set timeToWait and timesToLaunch to a minimum of 1 (day) or use showDefault())
  • don't hide the never button. If the user does not want to rate the app it is his decision, not yours. Don't force him ;)
  • set the title or message adapted to your app name. This will make it look and sound better
  • set an email address if you use the StarBuilder
  • don't set minimumNumberOfStars to 5
  • you should have a good reason to make the dialog not cancelable

Contribution

This is my first Open Source project. If you see anything you can improve please inform me or make a pull request. If you would like to add some features you can make a pull request too.

License

Copyright 2017 Lars Fessen

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.

Resources

A script to generate android assets from a SVG file. Requires inkscape to resize and convert.

android-widget-keyboardless-edittext - as a native Android EditText, except that no keyboard will appear when user interacts with it. All other edit operations still work.

fb-adb is a tool for interacting with Android systems. It does much of what adb does, but with better remote shell support and, hopefully, fewer bugs. Differences between adb and fb-adb are that fb-adb:

  • is binary clean (no LF -> CRLF mangling)
  • transmits and updates window size
  • distinguishes standard output and standard error
  • properly muxes streams with independent flow control
  • allows for ssh-like pty allocation control
  • propagates program exit status instead of always exiting with status 0
  • properly escapes program arguments
  • kills remote program
  • provides a generic facility to elevate to root without re-escaping

AXT

Android eXTentions is a lib for common Android-Code.

The aim of this project is to provide code that is used in a lot of Android-Apps over and over again this way:

  • reduce code in the apps ( -> more readable )
  • deduplicate code and tests ( -> save space & time )

A fast dependency injector for Android and Java.

This project represents Google's fork of Square's Dagger. Google's Dagger fork is intended to vary from Square's project only where features are needed to deviate from Square's feature-set. Google's Dagger should be a drop-in compatible alternative to Square's Dagger, and many features in this fork will, if successful, be merged into the upstream project.

Efforts are made to also keep Google's fork as close in structure to Square's as possible, to facilitate merging and compatibility. Google/dagger will release shortly after Square's releases.

A Java wrapper around Uber API using Retrofit.

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