Android Quickstart

Get started with Fingerprint device intelligence on Android.

Overview

In this quickstart, you’ll add Fingerprint to a new Android Studio project and identify the user’s device.

The example use case is new account fraud, where attackers create multiple fake accounts to abuse promotions, exploit systems, or evade bans. However, the steps you’ll follow apply to most front-end use cases. By identifying the device behind each sign-up attempt, your back end can flag suspicious behavior and block it early.

This guide focuses on the front-end mobile integration. You’ll install the Fingerprint Android SDK, initialize the agent to generate a request ID, and send that ID to your back end for analysis.

Estimated time: < 10 minutes

Prerequisites

Before you begin, make sure you have the following:

Note: This quickstart only covers the front-end setup. To enable fraud detection, you’ll need a back-end server to receive and process the device identification event.

1. Create a Fingerprint account and get your API key

  1. Sign up for a free Fingerprint trial if you don’t already have an account
  2. After signing in, go to the API keys page in the dashboard
  3. Copy your public API key as you’ll need this to initialize the Fingerprint client agent

2. Set up your Android project

To get started, create a new Android Studio project. If you already have a project you want to use, you can skip to the next section.

  1. Open Android Studio and choose New Project
  2. Select Empty Activity, then click Next
  3. Name your project (for example, “Fingerprint Quickstart”)
  4. Keep the default settings (as of this writing, that’s API 24: Android 7.0 (Nougat) as the minimum SDK and Kotlin as the language)
  5. Click Finish

Android Studio will generate a basic project for you. Once the project is ready, you’ll add the Fingerprint SDK.

3. Install the Fingerprint SDK

To integrate Fingerprint into your Android app, first add the SDK to your project.

Add the Fingerprint Maven repository

  1. In Android Studio, make sure you’re in Android view (top-left dropdown in the Project pane).
  2. Expand the Gradle Scripts section and open settings.gradle.kts.
  3. Find the dependencyResolutionManagement block and update the repositories section to include the Fingerprint Maven repository:
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://maven.fpregistry.io/releases") }
    }
}

Add the SDK dependency

  1. In the same Gradle Scripts section, open build.gradle.kts (Module: app).
  2. Inside the dependencies block, add:
implementation("com.fingerprint.android:pro:2.8.0")

Sync your project

After editing the files, sync your project by either:

  • Clicking Sync Now in the banner that appears
  • Or going to File > Sync Project with Gradle Files

Once syncing is complete, you’re ready to initialize the SDK.

4. Initialize the SDK

Now that the SDK is installed, you can import and initialize it in your app.

  1. In Android view, open MainActivity.kt (in app > kotlin+java > [your.package.name]) and add the following imports:
import com.fingerprintjs.android.fpjs_pro.Configuration
import com.fingerprintjs.android.fpjs_pro.FingerprintJSFactory
  1. Additionally, add these imports you’ll need for some basic UI:
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.unit.dp
import androidx.compose.ui.graphics.Color
import android.util.Log
  1. Next, initialize the Fingerprint client before setContent in your onCreate function:
// ...
enableEdgeToEdge()

val configuration = Configuration(
    apiKey = "<your-public-api-key>",
    region = Configuration.Region.US // Ensure this matches your workspace region
    // For more information, see https://dev.fingerprint.com/docs/regions
)

val fpjsClient = FingerprintJSFactory(applicationContext).createInstance(configuration)

setContent {...}
// ...
  1. Replace <your-public-api-key> with your actual public API key from the Fingerprint dashboard.

5. Trigger identification

Now that the Fingerprint client is initialized, you can identify the visitor only when needed. In this case, that’s when the user taps a “Create Account” button.

When making the visitor identification request, you will receive the visitorId as well as a requestId. Instead of using the visitorId returned directly on the front end (which could be tampered with), you’ll send the requestId to your back end. This ID is unique to each identification event. Your server can then use the Fingerprint Events API and retrieve the complete identification data, including the trusted visitor ID and other actionable insights like whether they are using a VPN or are a bot.

Add a basic sign-up UI with Compose

  1. Create a new composable function for the account creation screen. It will display a simple form with username and password fields, along with a “Create Account” button.
@Composable
fun CreateAccountScreen(
    onSubmit: () -> Unit,
    modifier: Modifier = Modifier
) {
    Column(
        modifier = modifier
            .fillMaxSize()
            .padding(16.dp),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        val accentColor = Color(0xFFF35B22)

        Text(
            text = "Create account",
            style = MaterialTheme.typography.headlineSmall,
            color = accentColor
        )

        Spacer(modifier = Modifier.height(24.dp))

        var username by remember { mutableStateOf("") }
        var password by remember { mutableStateOf("") }

        OutlinedTextField(
            value = username,
            onValueChange = { username = it },
            label = { Text("Username") },
            modifier = Modifier.fillMaxWidth(),
            colors = OutlinedTextFieldDefaults.colors(
                focusedBorderColor = accentColor,
                unfocusedBorderColor = accentColor,
                cursorColor = accentColor
            )
        )

        Spacer(modifier = Modifier.height(12.dp))

        OutlinedTextField(
            value = password,
            onValueChange = { password = it },
            label = { Text("Password") },
            visualTransformation = PasswordVisualTransformation(),
            modifier = Modifier.fillMaxWidth(),
            colors = OutlinedTextFieldDefaults.colors(
                focusedBorderColor = accentColor,
                unfocusedBorderColor = accentColor,
                cursorColor = accentColor
            )
        )

        Spacer(modifier = Modifier.height(24.dp))

        Button(
            onClick = onSubmit,
            colors = ButtonDefaults.buttonColors(containerColor = accentColor)
        ) {
            Text("Create Account")
        }
    }
}
  1. Replace the existing call to Greeting in your onCreate function with the CreateAccountScreen composable and pass in a placeholder for the submit function. Be sure to apply the provided innerPadding so the content respects system UI insets:
setContent {
    FingerprintQuickstartTheme {
        Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
            CreateAccountScreen(
                onSubmit = { /* TODO: Handle account creation */ },
                modifier = Modifier.padding(innerPadding)
            )
        }
    }
}
  1. Now replace the placeholder onSubmit function with a call to Fingerprint’s getVisitorId method. This will capture the device’s details and return a requestId, which you can then send to your back end:
setContent {
    FingerprintQuickstartTheme {
        Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
            CreateAccountScreen(
                onSubmit = {
                    fpjsClient.getVisitorId { result ->
                        val requestId = result.requestId
                        Log.d("Fingerprint", "Request ID: $requestId")
                        // Send this request ID to your backend
                    }
                },
                modifier = Modifier.padding(innerPadding)
            )
        }
    }
}

This setup ensures you’re triggering device identification only when needed.

6. Run the app

  1. Run the app on an emulator or physical device.

    To learn how to set up Android Studio to run an emulator or connect a physical Android device, see the official Android Studio setup guide.

  2. Type in a username and password and click the “Create Account” button.

  3. Open Logcat (View > Tool Windows > Logcat) and filter by the Fingerprint tag (tag:Fingerprint) to find your log message:

Request ID: 1234566477745.abc1GS

You’re now successfully identifying the device and capturing the request ID and are ready to send it to your back end for further fraud prevention logic!

Next steps

To use the identification data for fraud detection (like blocking repeat fake account attempts), you’ll need to send the requestId to your back end. From there, your server can call the Fingerprint Events API to retrieve the full visitor information and make decisions.