System Requirements
- Android 7.0 (API level 24) or higher
- Kotlin 1.5 or higher
- Gradle 7.0 or higher
Installation
Add Maven Repository
Add these lines to yoursettings.gradle file.
Add Dependency
Add these lines to yourbuild.gradle file.
For Groovy DSL
For Kotlin DSL
libs.versions.toml file.
Under the [versions] add:
[libraries] add:
Usage
Initialize the SDK
Callinit() in your Application class’s onCreate() method. Make sure to register this Application class in your AndroidManifest.xml.
Application class:
init() method initializes the Verisoul SDK with your project credentials. This method must be called once when your application starts.
Parameters:
context: Your application contextenvironment: The environment to useVerisoulEnvironment.Prodfor production orVerisoulEnvironment.Sandboxfor testingprojectId: Your unique Verisoul project identifier
Get Session ID
ThegetSessionId() method returns the current session identifier after the SDK has collected sufficient device data. This session ID is required to request a risk assessment from Verisoul’s API.
Important Notes:
- Session IDs are short-lived and expire after 24 hours
- The session ID becomes available once minimum data collection is complete (typically within seconds)
- You should send this session ID to your backend, which can then call Verisoul’s API to get a risk assessment
Reinitialize Session
Thereinitialize() method triggers session regeneration in the background and resets the SDK’s data collection. This is essential for maintaining data integrity when user context changes.
Example:
getSessionId() to retrieve the new session identifier:
Provide Touch Events
In order to gather touch events and compare them to device accelerometer sensor data, the app will need to provide touch events to Verisoul. The way to achieve this is to createBaseActivity, to override dispatchTouchEvent function and pass the data to Verisoul like shown below.
Error Codes
The SDK throwsVerisoulException with the following error codes:
| Error Code | Description | Recommended Action |
|---|---|---|
| INVALID_ENVIRONMENT | The environment parameter passed to Verisoul.init() is invalid. Valid values are “dev”, “sandbox”, or “prod”. | Ensure the environment parameter is exactly “dev”, “sandbox”, or “prod” (case-sensitive, no whitespace). |
| SESSION_UNAVAILABLE | A valid session ID could not be obtained. This typically occurs when Verisoul’s servers are unreachable due to network blocking or a very slow connection. | Implement exponential backoff. Prompt user to check network or disable network blocker. |
| WEBVIEW_UNAVAILABLE | WebView is not available on the device. This can occur when WebView is disabled, missing, uninstalled, or corrupted on the device. | Prompt user to enable WebView in settings, update Android System WebView, or switch devices. |
Exception Structure
All errors are thrown asVerisoulException with the following properties:
| Property | Type | Description |
|---|---|---|
| code | String | One of the error codes above |
| message | String | Human-readable error description |
| cause | Throwable? | The underlying exception that caused the error (if any) |
