Simple hot swapping implementation – GBG IDscan Documentation

Simple hot swapping implementation

  • Initialize resource manager for ProfileManager.

Java

ProfileManager.init(this);
  • 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");
  • Initialize MJCS (this needs to be done once before first swap)

Java

MJCS.init(this)
  • Swap Profile

Java

MJCS.swapProfile("UK")
  • 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?