This guide will help you set up and run the Verisoul Android Sample App, which demonstrates how to integrate Verisoul into an Android application.

About the Sample App

The Verisoul Android SDK is a demonstration project that showcases Verisoul’s fake user detection technology in an Android environment. The app includes:

  • Complete integration of Verisoul’s Android SDK
  • Touch event tracking and accelerometer data collection
  • Session-based fraud detection capabilities

Prerequisites

Before you begin, you’ll need:

  • Android Studio installed on your system
  • Android development knowledge
  • A device or emulator running Android
  • A Verisoul Project ID (obtain this by scheduling a call)

Installation Steps

1. Add the Repository

Add the Verisoul Maven repository to your project’s settings.gradle file:

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

2. Add the Dependency

You can add the Verisoul dependency using either Groovy DSL or Kotlin DSL.

Using Groovy DSL

Add this line to your module’s build.gradle file:

dependencies {
    // ... other dependencies
    implementation "ai.verisoul:android:0.3.1"
}

Using Kotlin DSL

For Kotlin DSL with version catalogs:

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

    Under the [versions] section:

    verisoul = "0.3.1"
    

    Under the [libraries] section:

    verisoul-android = { group = "ai.verisoul", name = "android", version.ref = "verisoul" }
    
  2. Then add this to your module’s build.gradle.kts file:

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

3. Implementation

Initialize the SDK

Create or modify your Application class to initialize Verisoul:

class YourApplication : Application() {

    override fun onCreate() {
        super.onCreate()

        Verisoul.init(
            this,
            VerisoulEnvironment.Prod, // or use Sandbox for testing
            "YOUR_VERISOUL_PROJECT_ID"
        )
    }
}

Make sure to register your Application class in your AndroidManifest.xml:

<manifest>
    <application
        android:name=".YourApplication">
        <!-- Activities and other components -->
    </application>
</manifest>

Get Session ID

Retrieve the session ID when needed:

Verisoul.getSessionId(
    callback = object : VerisoulSessionCallback {
        override fun onSuccess(sessionId: String) {
            // Use the sessionId for risk assessment
            Log.d("Verisoul", "Session ID: $sessionId")
        }

        override fun onFailure(exception: Exception) {
            // Handle any errors
            Log.e("Verisoul", "Failed to get session ID", exception)
        }
    }
)

Implement Touch Event Tracking

Create a base activity to capture touch events:

open class BaseActivity : AppCompatActivity() {

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

    // Other common BaseActivity code...
}

Then extend your activities from this base class:

class MainActivity : BaseActivity() {
    // Your activity implementation
}

What to Expect

Once integrated, the Verisoul SDK will:

  • Collect and analyze touch events and accelerometer data
  • Generate a unique session ID for risk assessment
  • Upload necessary data to Verisoul’s backend
  • Provide fraud detection capabilities for your Android application

Next Steps

After exploring the sample app, you can use it as a reference for implementing Verisoul in your own Android applications.

For more detailed documentation, see the Verisoul Integration Guide.