# How to Use the SDK ## Adding the SDK 1. In your Android Studio project, navigate to **“app” → “libs”**, right-click, and select **“Open in Finder.”** ![](../media/image3.png){width="3.25in" height="4.3in"} 2. In the Finder window that appears, open the **“libs”** folder, and paste the **`asr-a3xd-sdk.aar`** file into this folder. After pasting, you should see `asr-a3xd-sdk.aar` listed under “libs.” ![](../media/image4.png){width="5.6in" height="3in"} 3. Double-click **“build.gradle (Module: app)”** to open it. ![](../media/image6.png){width="2.75in" height="4.6in"} 4. Add the library to the dependencies section. Then click **“Sync Now”** at the top of the screen to synchronize. ![](../media/image7.png){width="6in" height="3.8in"} 5. When synchronization succeeds, the following screen will appear. **SDK installation is now complete.** ![](../media/image8.png){width="6in" height="1.5in"} --- ## Using the SDK ### Importing the Library Use the `import` statement to include the library in your target class. ```java import jp.co.asterisk.asreader.a3xd.sdk.AsReaderSDK; ``` ### Initializing `AsReaderSDK` ```java AsReaderSDK asReaderSDK = AsReaderSDK.getInstance(); ``` --- ### Implementing the `DeviceManagerCallback` Interface 1. Implement the `DeviceManagerCallback` interface. ```java // Example: Implementing DeviceManagerCallback in MainActivity public class MainActivity extends AppCompatActivity implements DeviceManagerCallback { ``` 2. Set the callback listener. ```java AsReaderSDK.getInstance().getDeviceManager().setCallback(this); ``` 3. Hover over the red underline (error indicator) and click **“Implement methods.”** ![](../media/image13.png){width="5.2in" height="1.6in"} 4. Select the methods you want to add and click **OK.** ![](../media/image14.png){width="5.6in" height="4in"} 5. The methods for `DeviceManagerCallback` will be automatically generated. ![](../media/image15.png){width="5.8in" height="3.5in"} --- ## Initializing the SDK Initialize the SDK. ```java AsReaderSDK.getInstance().initialize(context: this); ``` --- ### Power On Turn on the AsReader device. ```java AsReaderSDK.getInstance() .getDeviceManager() .setPowerWithOption( power: true, beep: true, vib: true, led: true, aimer: true, PowerOnBeep: true ); ``` --- ### Power Off Turn off the AsReader device. ```java AsReaderSDK.getInstance() .getDeviceManager() .setPowerWithOption( power: false, beep: true, vib: true, led: true, aimer: true, PowerOnBeep: true ); ``` --- ### Start Inventory Connect to the AsReader and start inventory (reading) of RF tag data. You can receive the inventory results via the [`onTagReceived`](./api/RFManagerCallback.md#ontagreceived) interface. ```java AsReaderSDK.getInstance() .getRFIDManager() .startInventory( maxTags: 0, maxTime: 0, repeatCycle: 0 ); @Override public void onTagReceived(int[] dest) { } ``` --- ### Stop Inventory Stop the RF tag inventory process. ```java AsReaderSDK.getInstance().getRFIDManager().stopDecode(); ```