> ## Documentation Index
> Fetch the complete documentation index at: https://docs.suprsend.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate Android SDK

> SDK Integration steps to enable AndroidPush notification in your native android app.

## Installation

<Steps>
  <Step title="Add the mavenCentral() repository to your build file.">
    <CodeGroup>
      ```groovy Add it in your root build.gradle at the end of repositories theme={"system"}
      allprojects {
      		repositories {
      			...
      			mavenCentral()
      		}
      	}
      ```
    </CodeGroup>
  </Step>

  <Step title="Add Android SDK dependency inside app level build.gradle">
    Add following line of code inside dependencies in app build.gradle

    <CodeGroup>
      ```java build.gradle theme={"system"}
      dependencies {
      	        implementation("com.suprsend:native:1.0.1")
      	}
      ```
    </CodeGroup>
  </Step>
</Steps>

## &#x20;Initialization

<Steps>
  <Step title="Initialising Suprsend Android SDK">
    To integrate SuprSend in your Android app, initialise the Suprsend android sdk in MainApplication inside `onCreate` method and just above `super.onCreate()` line.

    <CodeGroup>
      ```kotlin kotlin theme={"system"}
      class MyApplication : Application() {

          override fun onCreate() {
              SSApi.init(this,"WORKSPACE KEY", "WORKSPACE SECRET")
              super.onCreate()
          }
      }
      ```
    </CodeGroup>

    Replace **`WORKSPACE KEY`** and **`WORKSPACE SECRET`** with your workspace values. You will get both the tokens from [Suprsend API Keys ](https://app.suprsend.com/en/demo/developers/api-keys)[page ](https://app.suprsend.com/en/demo/developers/api-keys)***` (Settings page -> "API Keys"`***` section)`

    <Frame>
      <img src="https://mintcdn.com/suprsend/ftswjUsq0JlUh-RL/images/WorkspaceKeyandsecret.png?fit=max&auto=format&n=ftswjUsq0JlUh-RL&q=85&s=ded15b67f1663d53b1c7de21c3b14f3e" width="2880" height="638" data-path="images/WorkspaceKeyandsecret.png" />
    </Frame>
  </Step>

  <Step title="Import SuprSend SDK in your client side code">
    <CodeGroup>
      ```kotlin kotlin theme={"system"}
      val ssApi = SSApi.getInstance()
      ```
    </CodeGroup>
  </Step>
</Steps>

## Logging

By default the logs of SuprSend SDK are disabled. We recommend you to enable the SDK logs by setting its value to VERBOSE. You can enable the logs just in debug mode while in development by below condition.

<CodeGroup>
  ```kotlin kotlin theme={"system"}
  ssApi.setLogLevel(level: LogLevel)

  if (BuildConfig.DEBUG)
    ssApi.setLogLevel(LogLevel.VERBOSE)

  or

  //You can send the SDK exception to your Crashlytics server
  SSApi.setLogger(object : LoggerCallback {
    override fun i(tag: String, message: String) {
      // you will receive SDK info messages here
    }

    override fun e(tag: String, message: String, throwable: Throwable?) {
      throwable ?: return
      //Ex - FirebaseCrashlytics.getInstance().recordException(throwable)
    }
  })
  ```
</CodeGroup>

## ProGuard Rules (For release build)

For creating a release build you will need to add these below pro-guard rules:

<CodeGroup>
  ```yaml yaml theme={"system"}
  # SuprSend Sdk
  -dontwarn app.suprsend.**
  -keep class app.suprsend.**{*;}

  # Xiaomi
  -keep class app.suprsend.xiaomi.SSXiaomiReceiver {*;}
  #SDK has been obfuscated and compressed to avoid class not found error due to re-obfuscation.
  -keep class com.xiaomi.**
  #If the compiling Android version you are using is 23, you can prevent getting a false warning which makes it impossible to compile.
  -dontwarn com.xiaomi.push.**
  -keep class com.xiaomi.mipush.sdk.MiPushMessage {*;}
  -keep class com.xiaomi.mipush.sdk.MiPushCommandMessage {*;}
  -keep class com.xiaomi.mipush.sdk.PushMessageReceiver {*;}
  -keep class com.xiaomi.mipush.sdk.MessageHandleService {*;}
  -keep class com.xiaomi.push.service.XMJobService {*;}
  -keep class com.xiaomi.push.service.XMPushService {*;}
  -keep class com.xiaomi.mipush.sdk.PushMessageHandler {*;}
  -keep class com.xiaomi.push.service.receivers.NetworkStatusReceiver {*;}
  -keep class com.xiaomi.push.service.receivers.PingReceiver {*;}
  -keep class com.xiaomi.mipush.sdk.NotificationClickedActivity {*;}
  ```
</CodeGroup>

***
