BcmGlobalConfig

The SDK global configuration interface (BcmGlobalConfig) is a non optional interface. The interface is used for configuring underlying Biocapture SDK components, such as API keys, and global branding. You can consume this class by subclassing it, which enables lazy value computation.

Interface

Kotlin:

open class BcmGlobalConfig {

    /**
     * SDK licensing and activation
     */
    sealed class BcmLicensing
    object Trial : BcmLicensing()
    class Online(
        val key: String
    ) : BcmLicensing()

    class FloatingServer(
        val serverURL: String
    ) : BcmLicensing()

    class Offline(
        val key: String
    ) : BcmLicensing()

    // set license; default is trial
    open fun licensing(): BcmLicensing = Trial

    /**
     * Branding configuration interface; can be overwritten
     */
    open fun branding(): BcmBranding = BcmBranding()

}

Example

Kotlin:

class BcmGlobalConfig() : BcmGlobalConfig() {

    override fun licensing(): BcmLicensing = Trial

    // override fun licensing(): BcmLicensing = Offline("...token")
    override fun branding(): BcmBranding = BcmBranding()
    ...

}

Java:

public class BcmGlobalConfig extends BcmGlobalConfig {

    public BcmGlobalConfig() {
        super();
    }

    @Override
    public BcmLicensing licensing() {
        return BcmLicensing.Trial();
    }

    @Nullable
    @Override
    public BcmBranding branding() {
        return new BcmBranding();
    }

    ...

}

Usage

You can either inherit from the SDK Scan Activity (BcmScanActivity) and set the globalConfig or set the globalConfig at the Fragment level (BcmScanFragment).

Set the globalConfig at the Scan Activity level (BcmScanActivity)

Kotlin:

class YourBcmScanActivity : BcmScanActivity() {

    /**
     * Set config take place here
     */
    init {
        globalConfig = BcmGlobalConfig()
    }

}

Java:

public class YourBcmScanActivity extends BcmScanActivity {

    // Instance initialization block

    /**
     * Set config take place here
     */ {
        setGlobalConfig(new BcmGlobalConfig());
    }

}

Set the globalConfig at the Scan Fragment level (BcmScanFragment)

Kotlin:

val scanFragment: ScanFragment = BcmScanFragment(
    BcmGlobalConfig(),
    BcmScanConfig(),
    this);

Java:

BcmScanFragment scanFragment=new BcmScanFragment(
    new BcmGlobalConfig(),
    new BcmScanConfig(),
    this);

See Also

results matching ""

    No results matching ""