Passing NFC tags to the WorkflowController on Android

For the WorkflowController to process NFC tags the current Activity has to pass them to the WorkflowController. You can accomplish this by passing the tag from NfcAdapter.enableReaderMode to onNfcTagDetected by yourself. Alternatively you can use the helper class NfcForegroundDispatcher included in the AusweisApp SDK Wrapper:

import com.governikus.ausweisapp.sdkwrapper.SDKWrapper.workflowController
import com.governikus.ausweisapp.sdkwrapper.card.core.NfcForegroundDispatcher

class MyActivity : AppCompatActivity() {
    [...]
    private lateinit var nfcDispatcher: NfcForegroundDispatcher

    override fun onCreate(savedInstanceState: Bundle?) {
        [...]

        nfcDispatcher = NfcForegroundDispatcher(this, workflowController)
    }

    override fun onResume() {
        super.onResume()
        nfcDispatcher.start()
    }

    override fun onPause() {
        super.onPause()
        nfcDispatcher.stop()
    }

You may have to add the following permission to your AndroidManifest.xml to receive NFC tags.

<uses-permission android:name="android.permission.NFC" />