Simple hot swapping implementation – GBG IDscan Documentation

Simple hot swapping implementation

1. Initialize resource manager for ProfileManager.

Java

ProfileManager.init(this);

2. Install selected profile, for this you need .zip path as FILE and you selected TAG – tags can be any name selected by you. Few examples EUROPE, ASIA, France, Belgium, EUROPE_ID_CARDS or COLECTION1.

Java

ProfileManager.install(file, "UK");

3. Initialize MJCS (this needs to be done once before first swap)

Java

MJCS.init(this)

4. Swap Profile

Java

MJCS.swapProfile("UK")

5. Launch DocumentScannerActivity or CustomerJouneyActivity

Note: TAG can be any name compatible with android file system, and not “default” as this is reserved and used if you switching back to default profile.

Kotlin Example: Swap Profile

GlobalScope.launch(Dispatchers.Main) {
           withContext(Dispatchers.IO) {
               // Initial init could have be done before so it's not necessary to repeat.
               MJCS.init(this@HotSwappingActivity)
               ProfileManager.install(profilePath, "PROFILE")
               val profile = ProfileManager.getProfile("PROFILE")
               profile?.let {
                   MJCS.swapProfile(it)
               }
           }
           val intent = Intent(this@HotSwappingActivity, DocumentScannerActivity::class.java)
           // Start document scanner.
           startActivity(intent)  
       }
Was this page helpful?