Shortly hot swapping allows changing profiles before each Customer Journey or Document Scanner calls. This should enable more flexible document scanning for a different country, type or regions-based requirements.
Requirements:
- Professional Services team will provide all required Profile packages as .zip.
- Customer (You) is responsible for storing, managing, downloading and pre-installing profiles on the device.
Before calling any profile manager function, you need to call ProfileManager.init(Context) if MJCS.init(this) was not called.
Simple hot swapping implementation.
1. Initialise 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. Initialise MJCS (this needs to be done once before the first swap)
Java
MJCS.init(this)
4. Swap Profile
Java
MJCS.swapProfile("UK")
5. Launch DocumentScannerActivity or CustomerJouneyActivity.
TAG can be any name compatible with an android file system, and not “default” as this is reserved and used if you switching back to the 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)
}