NFC Scanning – GBG IDscan Documentation

NFC Scanning

In this version NFC scanning has been introduced, it has been added as a step in CustomerJourney and the APIs are available for you to use and add to your application.

First NFCScanning needs 3 things to be initialised :

  • Current Activity
  • Current EnterpirseService
  • journeyID of the current journey

Kotlin

val nfcScanning = NFCScanning(this, enterpriseService, journeyID) 

After this we will need to create a listener where we will receive the result and the next RequiredAction

Kotlin

val listener = object : NFCScanning.NfcListener {
                   override fun onFailure(error: NFCError, action: RequiredAction.Action) {
                       //handle faluire
                   }
 
                   override fun onSuccess(action: RequiredAction.Action) {
                       // handle next required action
                   }
          }) 

We also need to override onActivityResult and call a method to parse the response and call the listener.

Kotlin

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    nfcScanning.responseHandler(requestCode, resultCode, data, listener)
} 

Then we can start the NFC Activity. To do this we’ll need the ResponseUpload object from the DocumentUpload and the listener that was just created

Kotlin

startActivityForResult(responseUpload, listener) 

Was this page helpful?