Skip to content

RFID reader

Open RFID Reader

Use the method below to open the RFID chip reading controller and start its processing.

#1

DocumentReader.Instance().startRFIDReader(MainActivity.this, new IDocumentReaderCompletion() {
    @Override
    public void onCompleted(int rfidAction, DocumentReaderResults results, Throwable error) {
        // do something
    }
});
DocumentReader.Instance().startRFIDReader(this@MainActivity) { rfidAction, results_RFIDReader, _ ->
    // do something
}

#2

DocumentReader.Instance().startRFIDReader(MainActivity.this, documentReaderCompletion, rfidReaderRequest);

private IDocumentReaderCompletion documentReaderCompletion = new IDocumentReaderCompletion() {
    @Override
    public void onCompleted(int action, DocumentReaderResults results, DocumentReaderException error) {
        // do something
    }
};

private IRfidReaderRequest rfidReaderRequest = new IRfidReaderRequest() {
    @Override
    public void onRequestPACertificates(byte[] serialNumber, PAResourcesIssuer issuer, IRfidPKDCertificateCompletion completion) {
        // do something
    }

    @Override
    public void onRequestTACertificates(String keyCAR, IRfidPKDCertificateCompletion completion) {
        // do something
    }

    @Override
    public void onRequestTASignature(TAChallenge challenge, IRfidTASignatureCompletion completion) {
        // do something
    }
};

#3

DocumentReader.Instance().startRFIDReader(MainActivity.this, documentReaderCompletion, null, rfidNotificationCompletion);

private IDocumentReaderCompletion documentReaderCompletion = new IDocumentReaderCompletion() {
    @Override
    public void onCompleted(int action, DocumentReaderResults results, DocumentReaderException error) {
        // do something
    }
};

private IRfidNotificationCompletion rfidNotificationCompletion = new IRfidNotificationCompletion() {
    @Override
    public void onRfidNotification(int notificationType, @Nullable @org.jetbrains.annotations.Nullable Bundle value) {
        Log.d("MainActivity", "RFID notification: " + notificationType + ", value: " + value);
    }
};

Stop RFID Reader

To stop the RFID chip reading controller programmatically, invoke:

DocumentReader.Instance().stopRFIDReader(MainActivity.this);
DocumentReader.Instance().stopRFIDReader(this@MainActivity)
Back to top