Skip to content

Transfer progress events

TransferProgressListener

Implement TransferProgressListener interface and set it in TransferProgressListenabletransfer if you want to listen to transfer progress events.

Example

MainActivity.java
public class MainActivity extends AppCompatActivity
        implements DeviceEngagementCallback, TransferProgressListener,
        TransferReceiveCallback {

    ...

    private WebAPITransfer webAPITransfer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        try {
            webAPITransfer = new WebAPITransfer()
                    .setTransferProgressListener(this)
                    .setTransferReceiveCallback(this);

        } catch (SDKException e) {
            Log.e(TAG, "onCreate", e);
            // handle failed initialization
        }
    }

    @Override
    public void onProgressEvent(@NonNull TransferProgressEvent transferProgressEvent) {
        Log.i(TAG, transferProgressEvent.toString());
        // update UI with progress information
    }

    ...
}

List of available events

  • START - Starting transfer
  • CONNECTED - Connected to other device or server
  • SCAN_STARTED - Scan for devices started (BLE only)
  • SCAN_STOPPED - Scan for devices stopped (BLE only)
  • DEVICE_FOUND - Device found (BLE only)
  • NO_DEVICE_FOUND - No device found (BLE only)
  • TRY_RECONNECTION - Try reconnection (BLE only)
  • READER_VERIFIED - Reader verified (BLE only)
  • READER_NOT_VERIFIED - Reader not verified (BLE only)
  • COMPLETE - Complete transfer
  • FORCE_STOP - Transfer was stop
  • SESSION_TERMINATED - Session terminated