public class Trialy
extends java.lang.Object
The library is configured via the host app using an app key (can be found on your developer dashboard). The library determines whether a user should have access to the locked content. A hard-coded policy defines a threshold for allowable number of server or client failures before the library reports the user as not having access.
Constructor and Description |
---|
Trialy(android.content.Context context,
java.lang.String appKey) |
Modifier and Type | Method and Description |
---|---|
void |
checkTrial(java.lang.String sku, TrialyCallback callback)
Checks if the user should have access to the specified trial SKU
|
void |
clearLocalCache()
Clears the local cache (useful when testing your app)
|
static java.lang.String |
getStatusMessage(int status)
Provides a human-readable log message for each API status
|
void |
recordConversion(java.lang.String sku, TrialyCallback callback)
Records a "purchased IAP" conversion event.
|
void |
startTrial(java.lang.String sku, TrialyCallback callback)
Starts a trial for the specified trial SKU
|
public Trialy(android.content.Context context, java.lang.String appKey)
context
- Your activity's ContextappKey
- Your app key; can be found on your Trialy developer dashboardpublic void checkTrial(java.lang.String sku, TrialyCallback callback)
sku
- The trial SKU as defined in your developer dashboard (should match the IAP SKU)callback
- A callback implemented by your activity to deal with the trial status response (e.g. trial running, trial expired, etc.)public void startTrial(java.lang.String sku, TrialyCallback callback)
sku
- The trial SKU as defined in your developer dashboard (should match the IAP SKU)callback
- A callback implemented by your activity to deal with the API response (e.g. trial started, trial already running, etc.)public void recordConversion(java.lang.String sku, TrialyCallback callback)
sku
- The trial SKU as defined in your developer dashboard (should match the IAP SKU)callback
- A callback implemented by your activity to deal with the API response (e.g. conversion recorded)public void clearLocalCache()
public static java.lang.String getStatusMessage(int status)
status
- The status int returned by the APIModifier and Type | Field and Description |
---|---|
static int |
ERROR_APP_NOT_FOUND |
static int |
ERROR_CONTACTING_SERVER |
static int |
ERROR_TRIAL_SKU_NOT_FOUND |
static int |
STATUS_RECORDED_CONVERSION |
static int |
STATUS_TRIAL_JUST_ENDED |
static int |
STATUS_TRIAL_JUST_STARTED |
static int |
STATUS_TRIAL_NOT_YET_STARTED |
static int |
STATUS_TRIAL_OVER |
static int |
STATUS_TRIAL_RUNNING |