Ana Llamas
Sep 21, 2017
3:38 pm

Admin does not have android.permission.sec.MDM_APP_MGMT

I am testing an app in a Samsung J3 device with Android 5.1.1 and calling this method: appPolicy.addPackagesToForceStopBlackList(list);

I get this exception: Admin does not have android.permission.sec.MDM_APP_MGM.

I have the permission in the manifest like this:

<permission android:name="android.permission.sec.MDM_APP_MGMT"/>

I do not understand what the problem is.

Thanks in advanced!

Samuel Goldwax
Sep 21, 2017
4:14 pm

Hi Ana,

Could you try changing 'permission' to 'uses-permission'? If this still doesn't work, you could also try getting the permission at runtime using the applyRuntimePermissions API.

 

Thanks,

Sam

Ana Llamas
Sep 21, 2017
4:21 pm

Comments

I saw this on Internet, is it a problem with Android 5.1.1?

https://github.com/martinmarinov/rtl_tcp_andro-/issues/11

Ana LlamasSep 21, 2017 at 4:35 pm
Samuel Goldwax
Sep 21, 2017
4:33 pm

Hi Ana,

Could you check to make the the license is activating successfully? You can do that by creating a broadcast receiver a filtering by the EnterpriseLicenseManager.ACTION_LICENSE_STATUS action. If the license is activated successfully and you're still not being granted the permission, please reproduce the issue and take a device dump state and send it to me at s.goldwax.samsung@gmail.com and I'll investigate the issue further.

 

Thanks,

Sam

Comments

I sent you a device dump state to see the problem, any news?

Ana LlamasSep 28, 2017 at 8:19 am
Filipe Silva
Sep 25, 2017
11:50 am

Hi Samuel,

I'm having the same problem that Ana has reported.

I'm trying to integrate the Knox Standard SDK 5.9 into my Android application.

I have my main activity which is going to request admin privileges when started:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    Log.d("KNOX", "MainActivity.onActivityResult()");

    if (requestCode == KnoxUtils.DEVICE_ADMIN_ADD_RESULT_ENABLE) {

        switch (resultCode) {
            case Activity.RESULT_CANCELED:
                Log.d("KNOX", "Request failed.");
                break;
            case Activity.RESULT_OK:
                Log.d("KNOX", "Device administrator activated.");

                KnoxUtils.activateLicenses(this); // Activate Knox license

                break;
        }
    }
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    KnoxUtils.requestAdminPrivileges(this); // Request Admin Privileges
}

Then I have my KnoxUtils class where the methods to request the admin privileges and to activate the licenses are.

The licenses are activated when the admin privileges are granted by the user, and, as stated in the tutorials, I'm activating both the ELM and the KLM licenses as my device has Knox version 2.6.

public class KnoxUtils {

    private static final String TAG = "KnoxUtils";

    public static final int DEVICE_ADMIN_ADD_RESULT_ENABLE = 1;

    private static final String knoxKLMKey_ = "KLM0..."; // <--- license hidden
    private static final String knoxELMKey_ = "28E88..."; // <--- license hidden


    public static void requestAdminPrivileges(Context context){
        // Ensure app has device admin privileges
        ComponentName deviceAdmin = new ComponentName(context, NativeAdminReceiver.class);
        DevicePolicyManager dpm = (DevicePolicyManager)context.getSystemService(Context.DEVICE_POLICY_SERVICE);
        if(!dpm.isAdminActive(deviceAdmin)) {
            Log.i(TAG, "Enabling app as device admin.");
            try {
                Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
                intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, deviceAdmin);
                intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "");
                ((Activity)context).startActivityForResult(intent, DEVICE_ADMIN_ADD_RESULT_ENABLE);
            } catch (Exception e) {
                Log.i(TAG, "Exception: " + e);
            }
        } else {
            Log.i(TAG, "App already has device admin privileges.");
            activateLicenses(context);
        }
    }

    /**
     * Activate licenses to support devices with Knox v2.7 or earlier
     *
     * @param context
     */
    public static void activateLicenses(Context context) {
        // Get an instance of the License Manager
        EnterpriseLicenseManager elmManager = EnterpriseLicenseManager.getInstance(context);

        // Activate the backwards-compatible backwards-compatible ELM license key
        elmManager.activateLicense(knoxELMKey_, context.getPackageName());

        // Get an instance of the Knox License Manager
        KnoxEnterpriseLicenseManager klmManager = KnoxEnterpriseLicenseManager.getInstance(context);

        // Activate the Samsung Knox License
        klmManager.activateLicense(knoxKLMKey_, context.getPackageName());
    }
}

Then I have my knox license receiver:

public class KnoxLicenseReceiver extends BroadcastReceiver {

    private final String EXTRA_LICENSE_STATUS_SUCCESS = "success";
    private final String EXTRA_LICENSE_STATUS_FAIL = "fail";

    void showToast(Context context, CharSequence msg) {
        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        boolean activated = false;
        int errorCode = 0;
        String action = intent.getAction();
        Log.d("KNOX", "KnoxLicenseReceiver.onReceive()");

        if (action.equals(EnterpriseLicenseManager.ACTION_LICENSE_STATUS)) {
            String result = intent.getStringExtra(EnterpriseLicenseManager.EXTRA_LICENSE_STATUS);

            activated = result.equals(EXTRA_LICENSE_STATUS_SUCCESS);
            errorCode = intent.getIntExtra(EnterpriseLicenseManager.EXTRA_LICENSE_ERROR_CODE, 0);

            showToast(context, "(ELM) Enterprise License activation: " + result + "\n" + "Error code: " + errorCode);
            Log.d("KNOX", "(ELM) Enterprise License activation: " + result + "\n" + "Error code: " + errorCode);
        } else if (action.equals(KnoxEnterpriseLicenseManager.ACTION_LICENSE_STATUS)) {
            String result = intent.getStringExtra(KnoxEnterpriseLicenseManager.EXTRA_LICENSE_STATUS);

            activated = result.equals(EXTRA_LICENSE_STATUS_SUCCESS);
            errorCode = intent.getIntExtra(EnterpriseLicenseManager.EXTRA_LICENSE_ERROR_CODE, 0);

            showToast(context, "(SKL/KLM) Samsung Knox License activation: " + result + "\n" + "Error code: " + errorCode);
            Log.d("KNOX", "(SKL/KLM) Samsung Knox License activation: " + result + "\n" + "Error code: " + errorCode);
        }

        if (activated) {
            EnterpriseDeviceManager edm = new EnterpriseDeviceManager(context);
            ApplicationPolicy appPolicy = edm.getApplicationPolicy();
            Intent taskType = ApplicationPolicy.LAUNCHER_TASK;
            ComponentName componentName = new ComponentName(packageName, packageName + ".HomeActivity");
            try {
                boolean retValue = appPolicy.setDefaultApplication(taskType, componentName);
                if (retValue) {
                    // Task type has been successfully assigned to the given ComponentName
                }
            } catch (SecurityException e) {
                Log.e("KNOX", "SecurityException: " + e);
            }
        }
    }
}

And the device admin receiver:

public class NativeAdminReceiver extends DeviceAdminReceiver {
    void showToast(Context context, CharSequence msg) {
        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
        Log.d("KNOX", "Native Admin Receiver = " + msg);
    }

    @Override
    public void onEnabled(Context context, Intent intent) {
        showToast(context, "Sample Device Admin: enabled");
    }

    @Override
    public CharSequence onDisableRequested(Context context, Intent intent) {
        return "This is an optional message to warn the user about disabling.";
    }

    @Override
    public void onDisabled(Context context, Intent intent) {
        showToast(context, "Sample Device Admin: disabled");
    }

    @Override
    public void onPasswordChanged(Context context, Intent intent) {
        showToast(context, "Sample Device Admin: pw changed");
    }

    @Override
    public void onPasswordFailed(Context context, Intent intent) {
        showToast(context, "Sample Device Admin: pw failed");
    }

    @Override
    public void onPasswordSucceeded(Context context, Intent intent) {
        showToast(context, "Sample Device Admin: pw succeeded");
    }
}

Finally in my manifest I have:

<uses-permission android:name="android.permission.sec.MDM_APP_MGMT" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <activity
        android:name=".HomeActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:screenOrientation="sensorLandscape"
        android:stateNotNeeded="true"
        android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <receiver
        android:name=".knox.NativeAdminReceiver"
        android:label="@string/app_name"
        android:permission="android.permission.BIND_DEVICE_ADMIN">
        <meta-data
            android:name="android.app.device_admin"
            android:resource="@xml/device_admin_receiver" />
        <intent-filter>
            <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
            <action android:name="android.app.action.DEVICE_ADMIN_DISABLED" />
        </intent-filter>
    </receiver>

    <receiver
        android:name=".knox.KnoxLicenseReceiver"
        android:enabled="true">
        <intent-filter>
            <action android:name="edm.intent.action.license.status" /> <!-- ELM License -->
            <action android:name="edm.intent.action.knox_license.status" /> <!-- SKL/KLM License -->
        </intent-filter>
    </receiver>

</application>

 

My device is a SM-T550 and has the following versions:

- Android 6.0.1

- KNOX 2.6

- Standard SDK 5.6.0

 

To summarize:

- I'm having the following error when trying to use "appPolicy.setDefaultApplication".

SecurityException: java.lang.SecurityException: Admin  does not have android.permission.sec.MDM_APP_MGMT

- I also noticed that only the "edm.intent.action.knox_license.status" broadcast is entering the receiver. (Don't know if that's a problem or not.)

Filipe Silva
Sep 27, 2017
4:45 pm

Please advise on the issue above as soon as possible, it's quite an urgent matter.

Samuel Goldwax
Sep 27, 2017
5:09 pm

Hi Filipe,

I've tried running the code you provided but the app crashed before it can even request admin priveleges. Could you try the following and let me know if this fixes the issue:

  • Using the activateLicense APIs that take only the string keys as parameters
  • Seperating ELM and KLM license activation
  • Downloading one of our sample apps and using their admin and license activation logic, and extending it to try calling setDefaultApplication

Please let me know if this helps.

 

Thanks,

Sam

Filipe Silva
Sep 28, 2017
11:20 am

Hi Samuel,

Here are my conclusions.

  • Using the activateLicense APIs that take only the string keys as parameters
    • Nothing changed.
  • Seperating ELM and KLM license activation
    • Trying to activate only the ELM license does NOT enter the license receiver, therefore, doesn't reach the "setDefaultApplication".
    • Trying to activate only the KML license enters the license receiver, which then calls the "setDefaultApplication" and throws the SecurityException mentioned previously.
  • Downloading one of our sample apps and using their admin and license activation logic, and extending it to try calling setDefaultApplication
    • I have successfully used the following sample app, which only requires an ELM license, and extend it to use the setDefaultApplication as you requested. What I also found out was that the reason it worked was because the version of the Knox Standard SDK used in this sample app is the 5.6 instead of the 5.9 I was trying to use.
    • Sample App used: https://seap.samsung.com/sample-app/get-started-knox-standard-sdk#

I need to keep working, so for now, I will use the version 5.6 of the SDK, but I would like to be able to use the latest versions and get access to its functionalities so, if you find the problem or want me to try something else, please let me know.

P.S. I can use the .jar files of the 5.6 version of the SDK that are inside of the sample app I used, but could you point me to where I could download these older versions, not only for the Standard SDK but also for the other ones available.

Samuel Goldwax
Sep 28, 2017
4:33 pm

Hi Filipe,

I just finished writing a quick app using Knox 5.9 and was able to use the setDefaultApplciation API without issues. Here's my code:

MainActivity:

public class MainActivity extends AppCompatActivity {

    private final String TAG = "MainActivity";
    static final int DEVICE_ADMIN_ADD_RESULT_ENABLE = 1;

    private ComponentName mDeviceAdmin;
    private DevicePolicyManager mDPM;
    Button ToggleAdminBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mDeviceAdmin = new ComponentName(this, SampleAdminReceiver.class);
        mDPM = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);

        ToggleAdminBtn = (Button) findViewById(R.id.ToggleAdminBtn);
        Button ActivateELMBtn = (Button) findViewById(R.id.ActivateELMBtn);
        Button SetDefaultAppBtn = (Button) findViewById(R.id.SetDefaultAppBtn);
        Button RemoveDefaultAppBtn = (Button) findViewById(R.id.RemoveDefaultAppBtn);

        ToggleAdminBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                toggleAdmin();
            }
        });
        ActivateELMBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                activateELM();
            }
        });
        SetDefaultAppBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setDefaultApp();
            }
        });
        RemoveDefaultAppBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                removeDefaultApp();

            }
        });
    }

    private void toggleAdmin() {
        DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(DEVICE_POLICY_SERVICE);

        boolean adminActive = dpm.isAdminActive(mDeviceAdmin);

        if (adminActive) { // If Admin is activated
            // Deactivate this application as device administrator
            dpm.removeActiveAdmin(new ComponentName(this, SampleAdminReceiver.class));
            finish();
        } else { // If Admin is deactivated
            // Ask the user to add a new device administrator to the system
            Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
            intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mDeviceAdmin);
            // Start the add device admin activity
            startActivityForResult(intent, DEVICE_ADMIN_ADD_RESULT_ENABLE);
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == DEVICE_ADMIN_ADD_RESULT_ENABLE) {
            switch (resultCode) {
                case Activity.RESULT_CANCELED:
                    Toast.makeText(this, "Admin cancelled", Toast.LENGTH_SHORT).show();
                    break;
                case Activity.RESULT_OK:
                    Toast.makeText(this, "Admin activated", Toast.LENGTH_SHORT).show();
                    refreshButtons();
                    break;
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        refreshButtons();
    }

    private void refreshButtons() {
        boolean adminState = mDPM.isAdminActive(mDeviceAdmin);
        if (!adminState) {
            ToggleAdminBtn.setText(getString(R.string.activate_admin));
        } else {
            ToggleAdminBtn.setText(getString(R.string.deactivate_admin));
        }
    }

    private void activateELM() {
        EnterpriseLicenseManager elmManager = EnterpriseLicenseManager.getInstance(this);
        try {
            elmManager.activateLicense(Constants.ELM_LICENSE_KEY);
            Toast.makeText(this, "Activating license...", Toast.LENGTH_SHORT).show();

        } catch (Exception e) {
            Toast.makeText(this, "SE: " + e, Toast.LENGTH_SHORT).show();
        }
    }

    private void setDefaultApp() {
        EnterpriseDeviceManager edm = new EnterpriseDeviceManager(this);
        ApplicationPolicy appPolicy = edm.getApplicationPolicy();
        Intent taskType = ApplicationPolicy.SMS_MMS_TASK;
        ComponentName componentName = new ComponentName("com.android.mms", "com.android.mms.ui.ConversationComposer");
        try {
            boolean retValue = appPolicy.setDefaultApplication(taskType, componentName);
            if (retValue) {
                Toast.makeText(this, "Default app set", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(this, "Failed to set default app", Toast.LENGTH_SHORT).show();
            }
        } catch (SecurityException e) {
            Toast.makeText(this, "SecurityException: " + e, Toast.LENGTH_SHORT).show();
        }
    }

    private void removeDefaultApp() {
        EnterpriseDeviceManager edm = new EnterpriseDeviceManager(this);
        ApplicationPolicy appPolicy = edm.getApplicationPolicy();
        Intent taskType = ApplicationPolicy.SMS_MMS_TASK;
        ComponentName componentName = new ComponentName("com.android.mms", "com.android.mms.ui.ConversationComposer");
        try {
            boolean retValue = appPolicy.removeDefaultApplication(taskType, componentName);
            if (retValue) {
                Toast.makeText(this, "Default app removed", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(this, "Failed to remove default app", Toast.LENGTH_SHORT).show();
            }
        } catch (SecurityException e) {
            Toast.makeText(this, "SecurityException: " + e, Toast.LENGTH_SHORT).show();
        }
    }
}

 

LicenseReceiver:

public class SampleLicenseReceiver extends BroadcastReceiver {

    private int DEFAULT_ERROR_CODE = -1;

    private void showToast(Context context, int msg_res) {
        Toast.makeText(context, context.getResources().getString(msg_res), Toast.LENGTH_SHORT).show();
    }

    private void showToast(Context context, String msg) {
        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onReceive(Context context, Intent intent) {

        int msg_res = -1;

        if (intent == null) {
            // No intent action is available
            showToast(context, R.string.no_intent);
            return;
        } else {
            String action = intent.getAction();
            if (action == null) {
                // No intent action is available
                showToast(context, R.string.no_intent_action);
                return;
            }  else if (action.equals(EnterpriseLicenseManager.ACTION_LICENSE_STATUS)) {
                // ELM activation result Intent is obtained
                int errorCode = intent.getIntExtra(EnterpriseLicenseManager.EXTRA_LICENSE_ERROR_CODE, DEFAULT_ERROR_CODE);
                int resultType = intent.getIntExtra(EnterpriseLicenseManager.EXTRA_LICENSE_RESULT_TYPE, DEFAULT_ERROR_CODE);

                if (resultType == 800) {
                    if (errorCode == EnterpriseLicenseManager.ERROR_NONE) {
                        // ELM activated successfully
                        Toast.makeText(context, R.string.elm_activated_succesfully, Toast.LENGTH_SHORT).show();
                        Log.d("SampleLicenseReceiver", context.getString(R.string.elm_activated_succesfully));
                        return;
                    } else {
                        // ELM activation failed
                        switch (errorCode) {
                            case EnterpriseLicenseManager.ERROR_INTERNAL:
                                msg_res = R.string.err_elm_internal;
                                break;
                            case EnterpriseLicenseManager.ERROR_INTERNAL_SERVER:
                                msg_res = R.string.err_elm_internal_server;
                                break;
                            case EnterpriseLicenseManager.ERROR_INVALID_LICENSE:
                                msg_res = R.string.err_elm_licence_invalid_license;
                                break;
                            case EnterpriseLicenseManager.ERROR_INVALID_PACKAGE_NAME:
                                msg_res = R.string.err_elm_invalid_package_name;
                                break;
                            case EnterpriseLicenseManager.ERROR_LICENSE_TERMINATED:
                                msg_res = R.string.err_elm_licence_terminated;
                                break;
                            case EnterpriseLicenseManager.ERROR_NETWORK_DISCONNECTED:
                                msg_res = R.string.err_elm_network_disconnected;
                                break;
                            case EnterpriseLicenseManager.ERROR_NETWORK_GENERAL:
                                msg_res = R.string.err_elm_network_general;
                                break;
                            case EnterpriseLicenseManager.ERROR_NOT_CURRENT_DATE:
                                msg_res = R.string.err_elm_not_current_date;
                                break;
                            case EnterpriseLicenseManager.ERROR_NULL_PARAMS:
                                msg_res = R.string.err_elm_null_params;
                                break;
                            case EnterpriseLicenseManager.ERROR_SIGNATURE_MISMATCH:
                                msg_res = R.string.err_elm_sig_mismatch;
                                break;
                            case EnterpriseLicenseManager.ERROR_UNKNOWN:
                                msg_res = R.string.err_elm_unknown;
                                break;
                            case EnterpriseLicenseManager.ERROR_USER_DISAGREES_LICENSE_AGREEMENT:
                                msg_res = R.string.err_elm_user_disagrees_license_agreement;
                                break;
                            case EnterpriseLicenseManager.ERROR_VERSION_CODE_MISMATCH:
                                msg_res = R.string.err_elm_ver_code_mismatch;
                                break;
                            default:
                                // Unknown error code
                                String errorStatus = intent.getStringExtra(EnterpriseLicenseManager.EXTRA_LICENSE_STATUS);
                                String msg = context.getResources().getString(R.string.err_elm_code_unknown, Integer.toString(errorCode), errorStatus);
                                showToast(context, msg);
                                Log.d("SampleLicenseReceiver", msg);
                                return;
                        }

                        // Display ELM error message
                        showToast(context, msg_res);
                        Log.d("SampleLicenseReceiver", context.getString(msg_res));
                        return;
                    }
                }
            }
        }
    }
}

 

AdminReceiver:

public class SampleAdminReceiver extends DeviceAdminReceiver {

    void showToast(Context context, CharSequence msg) {
        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onEnabled(Context context, Intent intent) {
        showToast(context, "Device admin enabled");
    }

    @Override
    public void onDisabled(Context context, Intent intent) {
        showToast(context, "Device admin disabled");
    }
}

 

Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sam.setdefaultapp">

    <uses-permission android:name="android.permission.sec.MDM_APP_MGMT"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver
            android:name="com.sam.setdefaultapp.SampleAdminReceiver"
            android:description="@string/enterprise_device_admin_description"
            android:label="@string/enterprise_device_admin"
            android:permission="android.permission.BIND_DEVICE_ADMIN" >
            <meta-data
                android:name="android.app.device_admin"
                android:resource="@xml/device_admin_receiver" />
            <intent-filter>
                <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
            </intent-filter>
        </receiver>

        <receiver android:name="com.sam.setdefaultapp.SampleLicenseReceiver" >
            <intent-filter>
                <action android:name="com.samsung.android.knox.intent.action.LICENSE_STATUS" />
                <action android:name="com.samsung.android.knox.intent.action.KNOX_LICENSE_STATUS"/>
            </intent-filter>
        </receiver>

    </application>

</manifest>

 

My intuition is that something is going wrong with your ELM license activation, since it's not making it to the receiver. If it's not activated properly, you get security excpetions when calling Knox APIs. Perhaps looking through this code will help you debug.

 

Thanks,

Sam

Comments

Could you provide me with the full app?

Whatever I do within my app I seem to be unable to activate the ELM license as it never reaches the receiver. (The same license I was able to activate using the sample app)

Filipe SilvaSep 28, 2017 at 5:25 pm
Samuel Goldwax
Sep 28, 2017
6:39 pm

Hi Filipe,

There was actually a bug in the code I sent you. In the license receiver part of the AndroidManifest for the code I sent you, change the intent-filter action from 

com.samsung.android.knox.intent.action.LICENSE_STATUS to edm.intent.action.license.status

This should fix the issue.

 

Thanks,

Sam

Filipe Silva
Sep 28, 2017
7:19 pm

Hi Samuel,

It still doesn't work unfortunately. If you could provide me with your app I could do a more precise testing.

Another question: Are you considering the fact that my device only has Knox 2.6? 

Samuel Goldwax
Sep 28, 2017
8:59 pm

Hi Filipe,

The Knox version should not be an issue since the APIs used in the app are available since version 1.0. Please email me at s.goldwax.samsung@gmail.com and I'll send you the project over email.

 

Thanks,

Sam

Alexander Melnikov
Apr 11, 2018
9:15 am

It looks like the problem is in license agreement. When app requests for activate license it must to wait a responce in receiver for requested licenses. And only when responce have been received (also, it must be succesful) an app may call for protected Knox API. We have noticed, that there is a delay of responce for license request on Android 5.1.1, but perhaps this is our subjective feeling. I didn't noticed this problem on Android 5.0 and 5.0.2, but it was discovered on 5.1.1.