Getting started with the Android SDK

1. In Android Studio, insert the following line into your main module's build.gradle:

						  dependencies {
						  	//...
						  	compile 'io.trialy.library:trialy:1.0.9'
						  }
            

2. In your app's main activity, initialize the SDK with your app's key:

							@Override
					    	protected void onCreate(Bundle savedInstanceState) {
					        	super.onCreate(savedInstanceState);
					        	
					        	Trialy mTrialy = new Trialy(this, "YOUR_APP_KEY");
        						mTrialy.checkTrial("YOUR_TRIAL_SKU", mTrialyCallback);
					    	}
            
3. Modify your UI based on the returned result:

							   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;
							            }
							            Log.i("TRIALY", "Returned status: " + Trialy.getStatusMessage(status));
							        }
							
							    };
            
 
To start a trial, call mTrialy.startTrial("YOUR_TRIAL_SKU", mTrialyCallback);
 
If you're using a "per Google account" trial, also add the GET_ACCOUNTS permission to your AndroidManifest.xml:

					 <uses-permission android:name="android.permission.GET_ACCOUNTS" />
        	
That's it - to see if it's working, you can configure test responses from your account page
If you run into any issues, please contact us, we're here to help! To see all available features, check out the docs or try out the sample app