All Projects → karottenreibe → simpletrial

karottenreibe / simpletrial

Licence: Apache-2.0 License
Simple Android library to facilitate a trial period

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to simpletrial

Trialer
A small and simple library for managing trial period in your android app.
Stars: ✭ 44 (+193.33%)
Mutual labels:  trial
Flask-Stripe-MySQL-Bootstrapped
Flask template with microservices architecture. Fully integrated with Stripe 🚀
Stars: ✭ 124 (+726.67%)
Mutual labels:  trial-period
kerastuneR
R interface to Keras Tuner
Stars: ✭ 28 (+86.67%)
Mutual labels:  trial
responsive-html-email-templates
Collection of Free responsive HTML templates for Startups
Stars: ✭ 187 (+1146.67%)
Mutual labels:  trial
TrialMaker.Demo
A powerful yet straight-forward library suite that provides secure trial license generation and copy-protection features for .NET applications. It also supports premium license generation for expired free-trials.
Stars: ✭ 21 (+40%)
Mutual labels:  trial
awesome-hosting
List of awesome hosting
Stars: ✭ 134 (+793.33%)
Mutual labels:  trial
ctrdata
Aggregate and analyse information on clinical trials from public registers
Stars: ✭ 26 (+73.33%)
Mutual labels:  trial
TrialLicensing
Swift framework to deal with licensing and time-based trial periods in macOS apps.
Stars: ✭ 36 (+140%)
Mutual labels:  trial
NAGPythonExamples
Examples and demos showing how to call functions from the NAG Library for Python
Stars: ✭ 46 (+206.67%)
Mutual labels:  trial

simpletrial

Simple Android library to facilitate a trial period in your app.

Gradle

simpletrial is available via JCenter.

compile 'be.rottenrei:simpletrial:1.0.1' 

JCenter

Problem

Many developers want to give their users a grace-period after installing their app to test out premium features. After that period these features have to be bought. If the app cannot associate some account with the user, permanently storing their trial status is hard (c.f. this StackOverflow question).

Solution

There are many different indicators that can be used to facilitate a trial period, but, as outlined in this StackOverflow post, the least intrusive for the user are PackageManager.firstInstallTime and shared preferences, as they require no special permissions.

Combined with either Auto Backup or key-value backup, the user has to reinstall the app and subsequently clear its cache to reset the trial. This is sufficient work to deter the vast majority of users.

The simplest version of this library using Auto Backup looks like this:

// create 14 day trial using firstInstallTime and backuped shared preferences
SimpleTrial trial = new SimpleTrial(context, new SimpleTrial.Config());
if (trial.isTrialPeriodFinished()) {
    // ...
}

Backup

simpletrial works best if you backup its shared preference file to the cloud so it is restored when the user reinstalls the application. You have two options:

  • Enable Auto Backup. It will automatically back up all shared preference files. This is only available starting with Android 6.
  • Use key-value backup. This also works with lower Android versions but requires you to write some code.

To use key-value backup, you must add a BackupAgentHelper to your project and register a SharedPreferencesBackupHelper as described in the Android developer documentation to back up the shared preference file used by simplebackup. simplebackup will take care itself to request a backup from the BackupManager when necessary.

Combining with other factors

simpletrial is designed to let you add additional factors. Each factor must extend TrialFactor and any number of factors can be registered in the Config object passed to the SimpleTrial class:

SimpleTrial trial = new SimpleTrial(context, new SimpleTrial.Config().addFactor(
        new FileTrialFactor(new File("/some/path"))));
if (trial.isTrialPeriodFinished()) {
    // ...
}}

License

Apache 2

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].