# Installation & Initialization

Add the SDK to your `build.gradle.kts`. See [Maven Central](https://central.sonatype.com/artifact/com.finix/pax-mpos-sdk-android) or [MVN Repository](https://mvnrepository.com/artifact/com.finix/pax-mpos-sdk-android) for the latest version.


```kotlin
implementation("com.finix:pax-mpos-sdk-android:3.8.0")
```

Add the following to your `AndroidManifest.xml`:


```xml
<!-- Network communication -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<!-- Bluetooth communication (API 30 and below) -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<!-- Bluetooth communication (API 31+) -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
```

`BLUETOOTH_SCAN`, `BLUETOOTH_CONNECT`, and location permissions are required for API 31+.

If your build uses ProGuard, add the following to your `proguard-rules.pro`:


```text
-dontwarn retrofit.**
-keep class retrofit.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepattributes RuntimeVisibleAnnotations
-keepattributes RuntimeInvisibleAnnotations
-keepattributes RuntimeVisibleParameterAnnotations
-keepattributes RuntimeInvisibleParameterAnnotations
-keepattributes *Annotation*

-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-keep class com.google.gson.stream.** { *; }

-dontwarn com.finix.mpos.sdk.**
-keep class com.finix.mpos.sdk.** { *; }
-keep class com.finix.mpos.models.** { *; }
-keep class com.finix.common.networking.models.** { *; }
-dontwarn java.lang.invoke.StringConcatFactory
```

## Initialization

Create an `MPOSFinix` instance with your [credentials](/android/card-present/credentials):

## Connect to a Device

Call `connect()` with the PAX D135 Bluetooth name and MAC address:

| Callback | Trigger |
|  --- | --- |
| `onSuccess` | Device connected and ready to process transactions. |
| `onError` | Connection failed. Check Bluetooth pairing and device proximity. |
| `onProcessing` | Connection step in progress. Display `currentStepMessage` to the user if desired. |


## Device Management

| Method | Description |
|  --- | --- |
| `isConnected()` | Returns whether the device is currently connected. |
| `disconnect()` | Closes the Bluetooth connection to the device. |
| `resetDevice(MPOSConnectionCallback)` | Resets the device and re-establishes the connection. Accepts the same `MPOSConnectionCallback` as `connect()`. |


`resetDevice()` and `disconnect()` each provide two overloads:

- **Suspend overload** (`suspend fun resetDevice()`) — no callback required. Use this when calling from within a Kotlin coroutine.
- **Callback overload** (`resetDevice(MPOSConnectionCallback)`) — for traditional asynchronous handling outside of coroutines.