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

# Android Guide

> Documentation about the Usage SDK

To integrate the Usage SDK into your Android project, follow these steps:

## Adding the Repository

First, add the repository to your project’s `build.gradle` file:

```gradle theme={null}
repositories {
    maven {
        url 'https://packagecloud.io/Wave/UsageSDK/maven2'
    }
}
```

Add the sdk as a dependency in your module's `build.gradle`

```gradle theme={null}
implementation "br.com.wave:usage-sdk:+"
```

To always get the latest version.

```gradle theme={null}
implementation "br.com.wave:usage-sdk:1.+"
```

To get the latest Minor and Major versions.

***

## Initialization

After sync, add the SDK to your Application class

```kotlin theme={null}
Wave.Initialize(application = this, apiKey = "apiKey")
```

Where `apiKey` is the authentication key needed to start the flow. This information should be provided by Wave.

There are some optional parameters for this method that you can use, such as:

* `font:` the text font to be applied to all text views. You should pass the font res directly, like `R.font.font_name`
  If you face any issues, contact our team!

***

## Starting the Usage flow

To use the Home Component Feature, put the XML component in the Activity or Fragment XML:

```xml theme={null}
  <br.com.nomo.usage.ui.component.UsageHomeComponent
      android:id="@+id/usage_component"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent" />
```

Then, on your Activity or Fragment Kotlin file, pass de MSISDN number to the Component.

```kotlin theme={null}
val usageHomeComponent = findViewById<UsageHomeComponent>(R.id.usage_component)

val msisdn = ""
usageHomeComponent.setMSISDN(msisdn)
```

To start a feature, use the `start` method in an activity (context should be the activity's)

```kotlin theme={null}
Wave.start(context = this, feature = Feature.UsageSDK)
```

***

## Compatibility Issues

There might be some compatibility issues when launching Wave SDK.

1. Some UI components extend from Google's Material Components, so if the app's theme does not extend from `Theme.MaterialComponents`, it will crash. A way to solve this could be implementing bridge themes.
2. Inside app's theme, it is expected to have `<item name="windowNoTitle">true</item>` and `<item name="windowActionBar">false</item>`

***

## Minimum Android Version Recommendations for the Usage SDK

The Usage SDK supports devices running Android API level 24 (Android 7.0 Nougat) and higher.
