Trialy.io


Source link: https://github.com/trialy/trialy-android-sample

Trialy.io Android SDK

Trialy makes it super easy to create a free trial for your in-app-purchases. Trialy takes care of the heavy lifting for you (using server-side checks with customizable grace periods to allow offline use, for example) so you can focus on developing an amazing app.

  • Add the library to your app using gradle
  • Grab a free API key from here

For documentation and additional information see the website.

Download

dependencies {

compile 'io.trialy.library:trialy:1.0.5' 
}

Usage

Initialize the library in your main activity's onCreate() method:

 @Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

 //Initialize the library and check the current trial status on every launch

Trialy mTrialy = new Trialy(mContext, "YOUR_TRIALY_APP_KEY");

mTrialy.checkTrial("YOUR_TRIAL_SKU", mTrialyCallback);

  
}

Add a callback handler:

private TrialyCallback mTrialyCallback = new TrialyCallback() {

@Override

public void onResult(int status, long timeRemaining, String sku) {

 switch (status){

  case STATUS_TRIAL_JUST_STARTED:

//The trial has just started - enable the premium features for the user

 break;

  case STATUS_TRIAL_RUNNING:

//The trial is currently running - enable the premium features for the user

break;

  case STATUS_TRIAL_JUST_ENDED:

//The trial has just ended - block access to the premium features

break;

  case STATUS_TRIAL_NOT_YET_STARTED:

//The user hasn't requested a trial yet - no need to do anything

break;

  case STATUS_TRIAL_OVER:

//The trial is over

break;

  default:

Log.e(TAG, "Trialy response: " + Trialy.getStatusMessage(status));

break;

 
}

}

}
;

To start a trial, call mTrialy.startTrial("YOUR_TRIAL_SKU", mTrialyCallback); Your app key and trial SKU can be found in your Trialy developer dashboard.

If you're using a "per Google account" trial, also add the GET_ACCOUNTS permission to your AndroidManifest.xml (and request it within your app on Android 6.0+):

 <uses-permission android:name="android.permission.GET_ACCOUNTS" />

Resources

Widget for RecyclerView fast scrolling, like Android's built-in FastScroller for AbsListView.

MaterialToolbar makes it easy to build a Fragment navigation based application with fully customized toolbar views.

Snake library is a simple and animation line chart for Android.

Content Provider ORM for android. This ORM uses an android sqlite database as a backing store, but interactes with it using content providers. You use it like a normal ORM, by creating java objects, and then do all of you interations through the objects. And you get the added benefits of using it like normal content providers, so integration with list views and other components are simple.

SimpleUI is an Android library which helps you creating the activity UI more easier. You just have to configure the main things instead of coding them yourself.

Login Basics is an implementation of an Android app that support Login with Facebook, Google Plus (G+) and your own login logic. The aim of this project is to serve as basis to build apps that require login as a feature.

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