# Integrate Android framework

{% hint style="success" %}
Before you integrate the Android framework into your app:

* Contact [Xplor Pay](https://xplorpay.com/getting-started/) for a card reader and a public key.
* Locate the required .jar files in the [android-idtech-sdk/sdk/lib](https://github.com/clearent/android-idtech-sdk/tree/master/sdk/lib) folder.
  {% endhint %}

To integrate the Android framework into your app:

{% stepper %}
{% step %}
Add the `PublicOnReceiverListener` interface object to communicate back with your Android app.
{% endstep %}

{% step %}
Add the `ApplicationContext` interface object in your project for 2 in 1 mode (DIP/SWIPE).
{% endstep %}

{% step %}
Add the `ApplicationContext3In1` interface object in your project for 3 in 1 mode (CONTACTLESS/DIP/SWIPE).
{% endstep %}

{% step %}
Add the `DeviceFactory` interface to get an object of the device in which your app is installed.

This object enables your Android app to interact with the card reader.
{% endstep %}

{% step %}
Add the `device_configurePeripheralAndConnect()` method to use an audio jack reader for processing the payment through your Android app.

The `device_configurePeripheralAndConnect()` method retrieves an audio jack peripheral configuration from Xplor Pay's system based on the Android device in use. Peripheral specifications, such as the baud rate, vary across different Android devices.

{% hint style="warning" %}
If Xplor Pay does not support an audio jack peripheral configuration for your Android device, use the .xml file as a fallback based on the IDTech format. Insert the file location into the ApplicationContext interface object. Refer to the .xml file in the xml folder available in SDK Android Framework.
{% endhint %}
{% endstep %}

{% step %}
Add the `registerListen()` method to register the card reader connected using the Bluetooth settings.
{% endstep %}

{% step %}
Add the `isReady()` method to get notifications after connecting the card reader successfully.

{% hint style="warning" %}
Do not use the card reader until the public listener calls the `isReady()` method.
{% endhint %}
{% endstep %}

{% step %}
Add the `device_startTransaction()` method to start the card data process for the payment transaction.

{% hint style="warning" %}
The initial connection to the card reader may take some time as the configuration is applied to the reader’s flash memory. Once your app starts and connects to the card reader, no further configuration is required. A flag in the local storage prevents any additional configurations.
{% endhint %}
{% endstep %}
{% endstepper %}
