Dan Baruch
Jan 20, 2019
11:04 pm

Activating key

Okay, I've been struggling with this for few days now but can't seem to find a solution to my problem.

I have a device, I've following the immegration guide and added supportlib and knoxsdk jar files.

I've generate 2 keys, one for compatible and one for current SDK version.

I've pretty much copied pasted anything posted on Samsung's examples and still getting errors.

I'm trying to activate old license with the following code:

ComponentName cn = new ComponentName(this, MyDevicePolicyReceiver.class);
// Instantiate the EnterpriseLicenseManager class to use the activateLicense method
EnterpriseLicenseManager backwardsCompatibleKeyManager = EnterpriseLicenseManager.getInstance(this);

try {
    // Backwards-Compatible Key Activation TODO Add backwards-compatible key to Constants.java
    backwardsCompatibleKeyManager.activateLicense(Consts.KEY);

} catch (Exception e) {
    Log.d("ERROR",e.getMessage());
}

 

This results in SUCCESS message. How ever, when ever I try to activate anything from the Knox SDK I'm getting errors, for example:

Admin  does not have android.permission.sec.MDM_LOCATION OR com.samsung.android.knox.permission.KNOX_LOCATION

 

I have, how ever, activated the license and I have these lines in my manifest:

<uses-permission android:name="com.samsung.android.knox.permission.KNOX_LOCATION"/>
<uses-permission android:name="android.permission.sec.MDM_LOCATION"/>

 

This apply for anything I try. Like having these lines in the manifest:

<uses-permission android:name="com.samsung.android.knox.permission.KNOX_APP_MGMT"/>
<uses-permission android:name="android.permission.sec.MDM_APP_MGMT"/>

 

but still getting the exception:

Admin  does not have android.permission.sec.MDM_APP_MGMT OR com.samsung.android.knox.permission.KNOX_APP_MGMT

 

I have activated Admin for my app. I have also tried all of the above with the following activation function:

private void activateLicense() {
    // Instantiate the KnoxEnterpriseLicenseManager class to use the activateLicense method
    KnoxEnterpriseLicenseManager licenseManager = KnoxEnterpriseLicenseManager.getInstance(this);

    try {
        // License Activation TODO Add KPE license key to Constants.java
        licenseManager.activateLicense(Consts.KEY);

    } catch (Exception e) {
    }
}

 

But when ever I try to activate my Knox with this function I'm getting "unable to activate product key".

 

 

How do I continue from here?

Thanks, Dan

Similar topics

No similar topics found.
Mikayla N.Samsung SEAP Moderator
Jan 22, 2019
6:52 pm

Hi Dan,

The backwards compatible key does not grant any permissions. It only maps the new Knox SDK to the old namespace for devices running Knox versions earlier than 2.8. You need to activate your KPE key before you activate the backwards compatible key in order to be granted permissions. As well, confirm that you are passing your keys to your app for activation.

Best,

Mikayla

Comments

Thanks for the reply.

Okay, I'll remember that. I still how ever having issues with the KPE.

I've downloaded the example that disables the camera from here, put my key there, ran it but I always end up getting the following error:

"Unable to validate product key" (I'm translating from my language so it might not be 100% accurate words)

and if I debug all I get is unknown error.

So basically, I've tried few different devices but all of them are getting the same error. I've even tried creating a new KPE key but still getting the same error.

 

Here is the debug output if it helps:

com.samsung.android.knox.intent.extra.LICENSE_ATTESTATION_STATUS=-1
edm.intent.extra.knox_license.activaton_initiator=900
edm.intent.extra.knox_license.result_type=800
edm.intent.extra.knox_license.status=fail
edm.intent.extra.knox_license.errorcode=102

Dan BaruchJan 23, 2019 at 8:01 am
Mikayla N.Samsung SEAP Moderator
Jan 23, 2019
5:35 pm

Hi Dan,

Does your key start with KLM09? Also, what device are you using this on and what Knox version is it running? You can find the Knox version by going to Settings > About Phone > Software Information. If you enter your license key into the Check license key tool in https://www2.samsungknox.com/en/user, what Product ID is returned?

Best,

Mikayla

Comments

Hey,

Yes, my Key starts with KLM09.

The product ID I'm getting is MI-OSKON01WW-DEV

The phone I'm running is Android 8, Knox 3.0 (API level 24) TIMA 3.3.0 if it says anything and it's Galaxy S8.

 

I have another phone, Galaxy A7, tried running the example on it as well but the example said the phone is not supported. It's android version is 7.0 and it's knox is as follows:

Knox 2.8

Standard SDK 5.8.0

Premuim SDK 2.8.0

Customization SDK 2.8.0

Container 2.8.0

CEP 2.2.0

Enterprice Billing 1.3.0

OTP 2.6.0

SE for Android 2.4.3

Shared Devices 2.8.0

TIMA 3.3.007

VPB 2.4.0

When I tried to run my own app on this phone I got the same error, "Unable to verify product key"

Dan BaruchJan 24, 2019 at 7:16 am
Mikayla N.Samsung SEAP Moderator
Jan 24, 2019
10:01 pm

Hi Dan,

Thank you for the information. KPE Dev keys should start with KLM06. There was an issue in the backend a few weeks ago that was causing all KPE Dev keys to be generated as KLM09 keys for a short period of time. The KLM09 keys require package binding and cannot be validated from an app that is not bound to it. Dev keys do not require package binding. This issue has since been resolved and the dev keys are being generated correctly. Please revoke your dev key and generate a new key. This should generate a dev key starting with KLM06. Try activating your new key and tell me if you have any issues.  

 

As well, the backwards compatible key is only required if you plan to run your app on a device running Knox 2.7.1 or earlier. Both of the devices you mentioned are running newer versions of Knox, and do not require the backwards compatible key. 

Best,

Mikayla