/ Snackbar

Engage Users with a Snackbar to e.g. rate or translate the app

Engage Users with a Snackbar to e.g. rate or translate the app


Engage users with a Snackbar from the design lib to e.g. rate or translate the app.


Get the dependency via JitPack:

or from JCenter ( might be behind JitPack ) like this:

compile "org.ligi:snackengage:$version"

Just add this where you want ( e.g. in the onCreate method of your entry activity )

SnackEngage.from(this).withSnack(new DefaultRateSnack()).build().engageWhenAppropriate();

This would than show this snack after some opportunities and never again when once clicked on Rate ( which takes you to Play store or F-Droid - anything that accepts the generated market:// link )


Other snacks that are possible:



or create your own snack - e.g. to make a survey.

combine them as you wish and add your own conditions:

           .withSnack(new DefaultRateSnack())
           .withSnack(new GooglePlayOpenBetaTestSnack()
                              .withConditions(new NeverAgainWhenClickedOnce(),
                                              new AfterNumberOfOpportunities(42)))
           .withSnack(new TranslateSnack("https://www.transifex.com/projects/p/snackengage")
                              .withConditions(new IsOneOfTheseLocales(Locale.CANADA),
                              new NeverAgainWhenClickedOnce(),
                              new AfterNumberOfOpportunities(10)))



This lib came to exist because I wanted something like discreet-app-rate - but using a Snackbar from the new material design support lib which was emerging at Google I/O 2015.
After thinking about it I wanted to make it more broad - not only for rating - also engaging users by pointing them to beta-testing and translation.


The DefaultRateSnack just configures a RateSnack with default conditions:

public class DefaultRateSnack extends RateSnack {

    public DefaultRateSnack() {
        withConditions(new NeverAgainWhenClickedOnce(), new AfterNumberOfOpportunities(5));


you can easily roll your own analog to this default one:

public class AfterNumberOfOpportunities implements SnackCondition {

    private final int number;

    public  AfterNumberOfOpportunities(final int number) {
        this.number = number;

    public boolean isAppropriate(final SnackContext context, final Snack snack) {
        return context.getStats().getOpportunitiesSinceLastSnack() > number;

you can also have a custom snack with an image added:


.withSnack(new OpenURLSnack("market://details?id=org.ligi.survivalmanual", "survival") {

  protected Snackbar createSnackBar(final SnackContext snackContext) {
    Snackbar snackbar = super.createSnackBar(snackContext);
    final TextView textView = (TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text);
    textView.setCompoundDrawablesWithIntrinsicBounds(R.mipmap.survival, 0, 0, 0);
    return snackbar;
}.overrideTitleText("Other App by ligi:\nFree Offline Survival Guide")
 .overrideActionText("Get It!")