> For the complete documentation index, see [llms.txt](https://docs.licensespring.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.licensespring.com/sdks/tutorials/getting-started/c++/android-support.md).

# Android support

Since **v7.38.0**, LicenseSpring provides a C++ SDK built using the **Android NDK**, designed for Android applications. The SDK is compatible with Android devices running **Android API Level 24 (Android 7.0 Nougat)** or higher.

* **NDK Version**: 26.1.10909125 and 27.2.12479018
* **Minimum Android API Level**: 24 (Android 7.0 Nougat)
* **ABI version**: arm64-v8

The SDK provides native C++ functionality and is optimized for performance on supported Android devices.

## JNI initialization

The SDK includes JNI code used for computing the hardware ID of the Android device, and the default data path used for writing the license and log files:

* `Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID)` is used to compute the hardware ID.
* `context.getFilesDir().getAbsolutePath()` is used to compute the default data path.

To set these values and integrate the native LicenseSpring library into your app, include the following class in your project.

{% code title="LicenseSpring.kt" %}

```kotlin
package com.licensespring.android

import android.content.Context
import android.util.Log

object LicenseSpring {

    // This method decalaration exactly matches the signature declared in the LicenseSpring SDK. Don't remove it.
    external fun setAndroidContextAndIDs(context: Context)

    init {
        try {
            System.loadLibrary("LicenseSpring")
            Log.d("LicenseSpring", "Native library loaded successfully")
        } catch (e: UnsatisfiedLinkError) {
            Log.e("LicenseSpring", "Failed to load native library: ${e.message}")
        }
    }

    fun initialize(appContext: Context) {
        try {
            setAndroidContextAndIDs(appContext.applicationContext)
            Log.d("LicenseSpring", "Native context and IDs set successfully")
        } catch (e: Exception) {
            Log.e("LicenseSpring", "Error calling native method: ${e.message}")
        }
    }
}
```

{% endcode %}

{% hint style="info" %}
Include this snippet in your project and call `LicenseSpring.initialize(context)` during your app startup. If you don't want to pass the context to the LicenseSpring C++ SDK, you must set your own [**hardware ID**](https://docs.licensespring.com/sdks/tutorials/best-practices/hardware-id) and [**data path.**](https://docs.licensespring.com/sdks/tutorials/best-practices/local-license-file)
{% endhint %}

A full example is contained in the `samples/AndroidNDKSample` project, together with a demo Android app where you can activate and check licenses.


---

# 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.licensespring.com/sdks/tutorials/getting-started/c++/android-support.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.
