> For the complete documentation index, see [llms.txt](https://docs.digitalturbine.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalturbine.com/dt-ignite/getting-started-with-the-dt-ignite-services-sdk.md).

# Getting Started with the DT Ignite Services SDK

Integrating the DT Ignite Services (DTIS) SDK with your Host App allows you to connect to and interact with the Ignite client that is present on a device. The connection allows you to check for apps on the device, retrieve app metadata, install apps from the Ignite ecosystem, and launch apps after installation.

The following diagram provides an overview of how your Host App uses the DTIS SDK to communicate with Ignite on the device.

{% @mermaid/diagram content="sequenceDiagram
participant Host as Host App
participant SDK as Ignite

```
Host->>SDK: Initialize and Connect via Ignite Services SDK
Host->>SDK: Call SDK Methods

opt callback and/or broadcast
    SDK-->>Host: Task notifications
end

Host->>Host: Process notifications
Host->>SDK: Disconnect" %}
```

To integrate the DT Ignite Services (DTIS) SDK into your Host App:

* [Step 1: Set Up the DTIS SDK](#setup)
* [Step 2: Call SDK Methods](#call)
* [Step 3: Test Your Integration](#test)
* [Step 4: Prepare Host App for Production](#production)

## Step 1: Set Up the DTIS SDK <a href="#setup" id="setup"></a>

To set up the DTIS SDK:

1. Obtain a `clientID` from DT.\
   The `clientID` identifies your Host App in the DT environment.
2. Provide the `clientID` in the `meta-data` tag of the `AndroidManifest.xml` file for your Host app.

{% code title="XML" %}

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mycompany.myapp">

    <application ... >
		...

		<!-- Example Client ID -->
		<meta-data
    		 android:name="com.digitalturbine.ignite.aidl.CLIENT_ID"
	    	 android:value="52093f98-63a7-45b4-b9fb-191c685d6a40" />
	</application>
</manifest>
```

{% endcode %}

3. Add `ignite-service-aidl-sdk.aar` to your `libs/` folder in your project, or, if you use shared sources, import it as as a module.

## Step 2: Call SDK Methods <a href="#call" id="call"></a>

The DTIS SDK offers methods that allow you to interact with Ignite on a device. For a complete list of use cases and the appropriate methods to call, see [Use Cases](/dt-ignite/use-cases.md).

To call DTIS SDK methods in your Host App:

1. Declare and connect an instance of `IIgniteService.kt`. When connecting, the DTIS SDK authenticates the Host App using the credentials stored in `AndroidManifest.xml`. The `onConnected()` callback is sent only after authentication succeeds. For more information, see [Connect to Ignite](/dt-ignite/sdk-reference/connect-to-ignite.md).

{% code title="Kotlin" %}

```kotlin
lateinit var igniteService: IIgniteService

// ...

// After SDK is initialized, the IgniteService instance is returned.
// It can also be retrieved later using IgniteServiceSdk.instance()
// NOTE: `clientSecret` can be empty for initial integration
igniteService = IgniteServiceSdk.init(context, clientSecret)
// ...
IgniteServiceSdk.instance().connect(object: IConnectionCallback {
     override fun onConnected() {
          // Connection with Ignite is established
          Toast.makeText(applicationContext, "Connected.", Toast.LENGTH_SHORT).show()
     }

     override fun onDisconnected(message: String?) {
          Toast.makeText(applicationContext, "Disconnected from Ignite Service: $message", Toast.LENGTH_SHORT).show()
     }
})

// or

igniteService.connect(this)
```

{% endcode %}

2. Call DTIS SDK methods according to the [SDK Reference](/dt-ignite/sdk-reference.md).

{% code title="Kotlin" %}

```kotlin
findViewById<Button>(R.id.version).setOnClickListener {
    val result = IgniteServiceSdk.instance().version()
    Toast.makeText(applicationContext, "SDK version: ${result?.sdkVersion}, Ignite version: ${result?.igniteVersion}", Toast.LENGTH_SHORT).show()
}
```

{% endcode %}

3. Disconnect from Ignite. For more information, see [Disconnect from Ignite](/dt-ignite/sdk-reference/disconnect-from-ignite.md).

{% code title="Kotlin" %}

```kotlin
// ...

IgniteServiceSdk.instance().disconnect(this)

// ...
```

{% endcode %}

## Step 3: Test Your Integration <a href="#test" id="test"></a>

To test your DTIS integration, ensure that your test environment meets the following requirements:

* Ignite is installed on the test device. For more information about installing Ignite on a device, contact your DT Representative.
* Host App is integrated with DTIS and installed on the test device.
* Host App fingerprint and signing certificate are unique to Testing environment.

## Step 4: Prepare Host App for Production <a href="#production" id="production"></a>

Once you have completed testing your Host App, create a Production version of your Host App that uses a unique fingerprint and signing certificate that are different from the from those used in the testing environment.

## Example: Full Integration <a href="#h_01k3sbt7gtar00kdw5rqwzph04" id="h_01k3sbt7gtar00kdw5rqwzph04"></a>

The following example code shows a full integration using the DTIS SDK.

A fully integrated demo application is available on request for existing customers. For access to the demo application, contact your DT Representative.

{% code title="Kotlin" %}

```kotlin
class MainActivity : AppCompatActivity(), IConnectionCallback {
    // Remember instance or you can call IgniteServiceSdk.instance()
    lateinit var igniteService: IIgniteService

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        igniteService = IgniteService(applicationContext)
        igniteService.connect(this)

        // Call remote function on button click
        findViewById<Button>(R.id.version).setOnClickListener {
            val result = igniteService.version()
            Toast.makeText(applicationContext, "SDK version: ${result?.sdkVersion}, Ignite version: ${result?.igniteVersion}", Toast.LENGTH_SHORT).show()
        }

        findViewById<Button>(R.id.install).setOnClickListener {
            val file = File("${requireContext().filesDir}", "myfungame.apk")
            val data = file.toUri().toString()
            
            igniteService.install(data, object : IResponseCallback<InstallationResponse, Error, InstallationProgress> {
                override fun onSuccess(result: InstallationResponse) {
                    Log.d("InstallApp","onSuccess(): taskId=${result.taskId}, appId=${result.applicationId}, package=${result.packageName}, partnerMetadata=${result.partnerMetaData}")
                }

                override fun onError(error: Error) {
                    Log.d("InstallApp","onError(): message=${error.message}, code=${error.code}, partnerMetadata=${error.partnerMetadata}")
                }
            })
        }

        // Other API methods
    }

    override fun onConnected() {
        Toast.makeText(applicationContext, "Connected to Ignite Service", Toast.LENGTH_SHORT).show()
    }

    override fun onDisconnected(message: String?) {
        Toast.makeText(applicationContext, "Disconnected from Ignite Service: $message", Toast.LENGTH_SHORT).show()
    }

    override fun onDestroy() {
        super.onDestroy()
        igniteService.disconnect(this)
    }
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.digitalturbine.com/dt-ignite/getting-started-with-the-dt-ignite-services-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
