Class VerifierSDK
-
- All Implemented Interfaces:
public final class VerifierSDK
Main SDK static class that provides SDK initialization.
There are two methods for initializing the SDK
- initWithLicenseKey is used when you are provided the license key string. This method requires internet connection. When the initialization is done, the onInitSDK method of the InitSDKCallback is called with the VerifierSDKStatus as argument.
- initWithLicense is used when you are provided the license file. It requires the license file to be passed as an android resource. This method does not require internet connection. When called, the method returns the VerifierSDKStatus.
-
-
Method Summary
Modifier and Type Method Description static void
cacheLicense(boolean cacheLicense)
Sets the license caching. static VerifierSDKStatus
getStatus()
Returns the current SDK status. static void
initWithLicenseKey(@NonNull() Context context, @NonNull() String licenseKey, @NonNull() InitSDKCallback callback)
Initializes SDK given a license key. static boolean
clearLicenseCache(@NonNull() Context context, @NonNull() String licenseKey)
Clears the license cache. static VerifierSDKStatus
initWithLicense(@NonNull() Context context, @RawRes() int licenseResId)
Initializes SDK given a license android resource. static VerifierSDKStatus
initWithLicense(@NonNull() Context context, @NonNull() Array<byte> licenseBytes)
Initializes SDK given a license in bytes. -
-
Method Detail
-
cacheLicense
static void cacheLicense(boolean cacheLicense)
Sets the license caching. If set to true, the license will be cached in the application cache directory. This is useful when you want to avoid network calls on every application start.
The default value is false.
This method should be called before [VerifierSDK.initWithLicenseKey] is called.
- Parameters:
cacheLicense
- true if the license should be cached, false otherwise
-
getStatus
static VerifierSDKStatus getStatus()
Returns the current SDK status. The status after initialization should be INITIALIZED in order to use the rest of SDK.
-
initWithLicenseKey
static void initWithLicenseKey(@NonNull() Context context, @NonNull() String licenseKey, @NonNull() InitSDKCallback callback)
Initializes SDK given a license key. This method requires internet connectivity to operate. When initialization is done, onInitSDK is called with current VerifierSDKStatus.
You can use getStatus to get the current status in order to determine if SDK initialization is required
public class SomeActivity extends androidx.appcompat.app.AppCompatActivity implements InitSDKCallback { @Override protected void onCreate(android.os.Bundle savedInstanceState) { super.onCreate(savedInstanceState) // Activity creation } @Override protected void onResume() { super.onResume(); if (VerifierSDK.getStatus() != INITIALIZED) { VerifierSDK.initWithLicenseKey(this, "SOME_LICENSE_KEY", this); } } @Override public void onInitSDK(@NonNull VerifierSDKStatus status) { if (status == INITIALIZED) { // do stuff when SDK is initialized } else { // handle failed SDK initialization } } }
- Parameters:
context
- the application contextlicenseKey
- the license key provided with the SDKcallback
- the InitSDKCallback that is called upon SDK initialization
-
clearLicenseCache
static boolean clearLicenseCache(@NonNull() Context context, @NonNull() String licenseKey)
Clears the license cache.
- Parameters:
context
- the application context
-
initWithLicense
static VerifierSDKStatus initWithLicense(@NonNull() Context context, @RawRes() int licenseResId)
Initializes SDK given a license android resource. When initialization is done, the current VerifierSDKStatus is returned.
You can use getStatus to get the current status in order to determine if SDK initialization is required
public class SomeActivity extends androidx.appcompat.app.AppCompatActivity { @Override protected void onCreate(android.os.Bundle savedInstanceState) { super.onCreate(savedInstanceState) if (VerifierSDK.initWithLicense(this, R.raw.license) != INITIALIZED) { // handle failed SDK initialization } // Activity creation } }
- Parameters:
context
- the application contextlicenseResId
- the id of the license resource
-
initWithLicense
static VerifierSDKStatus initWithLicense(@NonNull() Context context, @NonNull() Array<byte> licenseBytes)
Initializes SDK given a license in bytes. When initialization is done, the current VerifierSDKStatus is returned.
You can use getStatus to get the current status in order to determine if SDK initialization is required
public class SomeActivity extends androidx.appcompat.app.AppCompatActivity { @Override protected void onCreate(android.os.Bundle savedInstanceState) { super.onCreate(savedInstanceState) byte[] licenseBytes = ...; if (VerifierSDK.initWithLicense(this, licenseBytes) != INITIALIZED) { // handle failed SDK initialization } // Activity creation } }
- Parameters:
context
- the application contextlicenseBytes
- the id of the license in bytes
-
-
-
-