Skip to content

A sample app demonstrating Verisoul's Android SDK integration

Notifications You must be signed in to change notification settings

verisoul/android-sdk

Repository files navigation

Verisoul logo

Android SDK

Overview

The purpose of this app is to demonstrate Verisoul's Android SDK integration.

To run the app a Verisoul Project ID is required. Schedule a call here to get started.

Getting Started

1. Add Repository

Add these lines to your settings.gradle file.

dependencyResolutionManagement {
    repositories {
        ...
        maven { url = uri("https://us-central1-maven.pkg.dev/verisoul/android") }
    }
}

2. Add Dependency

Add these lines to your build.gradle file.

For Groovy DSL

dependencies {
  ...
  implementation "ai.verisoul:android:1.0.3"
}

For Kotlin DSL

dependencies {
  ...
  implementation(libs.verisoul.android)
}

Add these lines to your libs.versions.toml file.

Under the [versions] add:

verisoul = "1.0.3"

Under the [libraries] add:

verisoul-android = { group = "ai.verisoul", name = "android", version.ref = "verisoul" }

Usage

1. Initialization

Initialization should be called in overridden onCreate() function from Application class that should be defined in the AndroidManifest.xml file. For example:

Application class

class SampleApplication : Application() {

    override fun onCreate() {
        super.onCreate()

        Verisoul.init(
            this,
            VerisoulEnvironment.Prod, // or Sandbox
            "<VERISOUL_PROJECT_ID>"
        )
    }
}

AndroidManifest.xml

<manifest>
    <application
        android:name=".SampleApplication">
            ...
    </application>
</manifest>

When this is called Verisoul library will be initialized, initial data together with session ID will be gathered and uploaded to Verisoul backend.

2. Get Session ID

Once the minimum amount of data is gathered the session ID becomes available. The session ID is needed in order to request a risk assessment from Verisoul's API. Note that session IDs are short lived and will expire after 24 hours. The application can obtain session ID by providing the callback as shown below:

Verisoul.getSessionId(
    callback = object : VerisoulSessionCallback {
        override fun onSuccess(sessionId: String) {
            // Upload session ID to backend
        }

        override fun onFailure(exception: Exception) {
            // Handle exception
        }
    }
)

3. 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 create BaseActivity, to override dispatchTouchEvent function and pass the data to Verisoul like shown below.

open class BaseActivity : Activity() {

    override fun dispatchTouchEvent(event: MotionEvent?): Boolean {
        Verisoul.onTouchEvent(event)
        return super.dispatchTouchEvent(event)
    }

    // Other common BaseActivity code...
}

In the application, just use BaseActivity as an Activity base class.

class MainActivity : BaseActivity() {

    // Other Activity code...
}

Questions and Feedback

Comprehensive documentation about Verisoul's Android SDK and API can be found at docs.verisoul.ai. Additionally, reach out to Verisoul at [email protected] for any questions or feedback.

About

A sample app demonstrating Verisoul's Android SDK integration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages