Menu

Activate a license

If you have not already, get a license.

You can activate the license with the activateLicense (String licenseKey, String pkgName) API method. Once you call this API method, a broadcast intent (ACTION_LICENSE_STATUS) will be sent with the result of license activation or validation result.

Note that this targeted broadcast is sent only to the application that calls the activateLicense(String) API method. Also, the system does a periodic validation of the license. It is recommended that you listen for this intent after activation

The following code snippet shows the API call used to activate the license:

protected Boolean activateIrisLicense() {
    try {
        IntentFilter filter = new IntentFilter();
        filter.addAction(SecBiometricLicenseManager.ACTION_LICENSE_STATUS);
        registerReceiver(mReceiver, filter);
        String key = ""; //need to fill a valid key
        String packageName = getApplicationContext().getPackageName();
        mLicenseMgr.activateLicense(key, packageName);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}

Note: It is recommended that you fetch the key from a web service over a secure connection. This decreases the possibility of your key being compromised. If your key is compromised and Samsung issues a replacement key, then your app retrieves and uses the new key, rather than attempting to use an invalid hard-coded key.