---
title: Trying the DaVinci module sample app for Android
description: Provides a step-by-step tutorial for configuring the `kotlin-davinci` sample app to authenticate a user with a PingOne DaVinci flow.
component: orchsdks
page_id: orchsdks:davinci:try-it-out/android/index
canonical_url: https://developer.pingidentity.com/orchsdks/davinci/try-it-out/android/index.html
revdate: Fri, 9 Jan 2026 17:23:51 +0000
keywords: ["DaVinci", "Android", "Tutorial", "kotlin-davinci", "Authentication", "PingOne"]
section_ids:
  before_you_begin: Before you begin
  step_1_download_the_samples: Step 1. Download the samples
  step_2_configure_the_sample_app: Step 2. Configure the sample app
  step_3_test_the_app: Step 3. Test the app
---

# Trying the DaVinci module sample app for Android

[icon: circle-check, set=far]PingOne [icon: android, set=fab]Android

* [Prepare](00_before-you-begin.html)

* [Download](01_downloading-forgerocksdk.html)

* [Configure](02_configuring-sample-for-davinci.html)

* [Run](03_running-sample-pingone.html)

**This tutorial walks you through updating the provided `kotlin-davinci` sample app so that it connects to a PingOne tenant to authenticate a user using the [PingOne sign-on with sessions](https://support.pingidentity.com/s/marketplace-integration/a7iDo00000110R2IAI/pingone-sign-on-with-sessions) DaVinci flow.**

> **Collapse: What functionality does the  sample demonstrate?**
>
> | Feature         | Supported by sample                                                                                                                              |
> | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
> | Orchestration   | * PingOne - DaVinci flows                                                                                                                        |
> | Implementation  | - Embedded *(tooltip: Provides its own user interface within the app to handle callbacks, rather than redirecting to the Identity Provider UI.)* |
> | Language        | * Kotlin                                                                                                                                         |
> | DaVinci Fields  | - Text
>
> - Password
>
> - Checkbox
>
> - Combobox
>
> - Dropdown
>
> - Label
>
> - Phone number                                                                  |
> | DaVinci Buttons | * Flow button
>
> * Submit
>
> * Social sign-on
>
> * Radio                                                                                               |
> | DaVinci Toolbox | - OTP device registration
>
> - OTP device authentication                                                                                           |

The `kotlin-davinci` application is a lightweight Android client.

![Screenshot of the \`kotlin-davinci\` sample app on Android.](../../_images/android-kotlin-davinci-sample.png)

It is designed to demonstrate a core capability of the DaVinci module for Android: rendering a dynamic user interface based on signals received from a DaVinci flow.

Instead of having a hardcoded login screen, the app starts a DaVinci flow and waits for the server to send instructions on what to display. It then constructs the UI on-the-fly, whether it's a username/password form, a message, or other interactive elements defined in your DaVinci flow.

The application's code showcases several important implementation patterns for integrating with DaVinci:

**1\. Dynamic UI Rendering with Jetpack Compose**

The app uses modern Android development practices, leveraging Jetpack Compose to build its user interface. The core logic resides in the `DaVinciScreen.kt` file.

* It observes a state object from the `DaVinciViewModel`.

* It uses a `when` statement to react to the current state of the DaVinci flow (`Login`, `Success`, or `Failure`).

* For the `Login` state, it iterates through the list of collectors returned from the DaVinci flow and renders the appropriate Composable for each one.

  This is the dynamic part—if you change the DaVinci flow the UI will change without needing to recompile the app.

**2\. State Management with ViewModel and StateFlow**

The application follows the recommended Android architecture by separating UI logic from business logic.

* `DaVinciViewModel.kt` is responsible for all interactions with the Ping Identity SDK.

* It uses a `MutableStateFlow` to hold the current state of the DaVinci flow (`DaVinciAction`). The UI (Composable functions) subscribes to this flow and automatically updates whenever the state changes.

  This decouples the SDK interaction from the UI, making the code cleaner and easier to test.

**3\. SDK Initialization and Configuration**

The app demonstrates how to initialize and configure the SDK to connect to your specific PingOne and DaVinci environment. In `DaVinciViewModel`, it shows how to:

* Provide the necessary DaVinci module configuration

* Start the DaVinci flow by calling `start()`.

**4\. Handling User Input**

The sample shows how to collect data from the dynamically rendered input fields, such as username and password fields, package it into a `Map`, and submit it back to DaVinci using the `action.next()` method.

This is the mechanism for advancing the flow after a user provides their credentials or makes a choice.

This flow allows users to register, authenticate, and verify their email address with PingOne.

## [Before you begin](00_before-you-begin.html)

Before you begin this tutorial ensure you have set up your PingOne server with the required configuration.

For example, you will need to have an OAuth 2.0 client application set up.

[**Complete prerequisites**[icon: chevrons-right, set=fas, size=xs]](00_before-you-begin.html)

## [Step 1. Download the samples](01_downloading-forgerocksdk.html)

To start this tutorial, you need to download the SDK sample apps repo, which contains the projects you will use.

[**Start step 1**[icon: chevrons-right, set=fas, size=xs]](01_downloading-forgerocksdk.html)

## [Step 2. Configure the sample app](02_configuring-sample-for-davinci.html)

In this step, you configure the sample app to connect to the OAuth 2.0 application you created in DaVinci.

[**Start step 2**[icon: chevrons-right, set=fas, size=xs]](02_configuring-sample-for-davinci.html)

## [Step 3. Test the app](03_running-sample-pingone.html)

To test the app, run the sample that you configured in the previous step.

The sample connects to your PingOne server to obtain the correct URIs to authenticate the user, and redirects the browser to your PingOne server.

After authentication, PingOne redirects the browser back to your application, which then obtains an OAuth 2.0 access token and displays the related user information.

[**Test app**[icon: chevrons-right, set=fas, size=xs]](03_running-sample-pingone.html)
