Skip to content

Latest commit

 

History

History
144 lines (100 loc) · 5.39 KB

README.md

File metadata and controls

144 lines (100 loc) · 5.39 KB

What

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

How

Get the dependency via JitPack:

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

implementation "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 )

rate screenshot

Other snacks that are possible:

rate screenshot rate screenshot

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

combine them as you wish and add your own conditions:

SnackEngage.from(view)
           .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)))

           .build()
           .engageWhenAppropriate();

The rate snack exists in different versions: snackengage-playrate and snackengage-amazonrate. You can use them in different flavors of your app.

Why

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.

Details

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</