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.”

  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.”

  3. Double-click “build.gradle (Module: app)” to open it.

  4. Add the library to the dependencies section.
    Then click “Sync Now” at the top of the screen to synchronize.

  5. When synchronization succeeds, the following screen will appear.
    SDK installation is now complete.


Using the SDK

Importing the Library

Use the import statement to include the library in your target class.

import jp.co.asterisk.asreader.a3xd.sdk.AsReaderSDK;

Initializing AsReaderSDK

AsReaderSDK asReaderSDK = AsReaderSDK.getInstance();

Implementing the DeviceManagerCallback Interface

  1. Implement the DeviceManagerCallback interface.

    // Example: Implementing DeviceManagerCallback in MainActivity
    public class MainActivity extends AppCompatActivity implements DeviceManagerCallback {
    
  2. Set the callback listener.

    AsReaderSDK.getInstance().getDeviceManager().setCallback(this);
    
  3. Hover over the red underline (error indicator) and click “Implement methods.”

  4. Select the methods you want to add and click OK.

  5. The methods for DeviceManagerCallback will be automatically generated.


Initializing the SDK

Initialize the SDK.

AsReaderSDK.getInstance().initialize(context: this);

Power On

Turn on the AsReader device.

AsReaderSDK.getInstance()
    .getDeviceManager()
    .setPowerWithOption(
        power: true,
        beep: true,
        vib: true,
        led: true,
        aimer: true,
        PowerOnBeep: true
    );

Power Off

Turn off the AsReader device.

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 interface.

AsReaderSDK.getInstance()
    .getRFIDManager()
    .startInventory(
        maxTags: 0,
        maxTime: 0,
        repeatCycle: 0
    );

@Override
public void onTagReceived(int[] dest) {
}

Stop Inventory

Stop the RF tag inventory process.

AsReaderSDK.getInstance().getRFIDManager().stopDecode();