# Android SDK

### Initialize SDK

The following guide provides steps to initialize the Conscent.ai SDK for your Android application. Please follow all the steps below carefully.

> minimum sdk required is 26. Please change it in app/build.gradle

### Add Dependencies

Add Auth Token

To access Bluepine’s private JitPack library, add this line in your project's gradle.properties file (your\_project/gradle.properties):

```java
authToken=jp_lumadc0egqfu7bvmh1g7pe9t13
```

**Add JitPack Repository**

In your project-level build.gradle file (your\_project/build.gradle), add the

maven repository inside the <mark style="color:green;">allprojects</mark> closure:

```java
buildscript {
     ...
   }
   allprojects {
      repositories {
          ...
          maven {
              url "http://jitpack.io"
              credentials { username authToken }
} }
}
```

**Gradle 7.0+**

If the allprojects closure does not exist, in your project's settings.gradle file (your\_project/settings.gradle), add the maven repository:

```java
  dependencyResolutionManagement {
       repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
       repositories {
... maven {
               url "http://jitpack.io"
               credentials { username authToken }
           }
} }
```

**Add the Conscent.ai SDK dependency**

```java
implementation 'club.conscent:loyalty_native_android:1.2.7'
```

Sync your project with Gradle files by clicking Sync Now.

<figure><img src="/files/Ma8CUZxPoxA7xS2pdfrK" alt="" width="375"><figcaption><p>Sync should succeed, at this point</p></figcaption></figure>

**Pair SDK with Dashboard**

Register Package Name

Open your Conscent .aiDashboard and go to Settings > Basic Details and register a Package Name.

<figure><img src="/files/ImXsSktij5Z5lHPDFDPx" alt=""><figcaption></figcaption></figure>

**Set Package Name**

Bluepine.setPackageName("\<package\_name\_same\_as\_registered\_in\_cons cent\_dashboard>");

**Initialize SDK**

The final step of initialization is to call the setPartnerIdAndUserId method. Initialise with a Partner ID

```java
BluePine.setPartnerIdAndUserId(“partnerId”, “UserID”)
```

**Initialize the SDK in your app's Application class or main entry point of the app. For integration purposes:**

* *If you are under activity*

```java
  import com.example.bluepine.module.BluePine
  class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      BluePine.stateBluePine(this.applicationContext)
} }
```

* *If you are in a composable*

```java
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier)
{
  val context = LocalContext.current
  Text(
    text = “Open BluePine”,
    modifier = Modifier.clickable {
      BluePine.stateBluePine(context)
    },
) }
```


---

# Agent Instructions: 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:

```
GET https://docs.conscent.ai/loyalty-system/android-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
