Douglas Wilson
Mar 25, 2016
7:06 pm

GPS: SecurityException: java.lang.SecurityException: No active admin owned by uid *****

Am just building a test app to turn GPS on and off.  In the MainActivity.onCreate I am activating the ELM license

elmManager = EnterpriseLicenseManager.getInstance(getApplicationContext());
elmManager.activateLicense(elmLicense, pkgName);

The receiver get Status success error code 0 and extra result type 800

A button on the screen is clicked to turn on GPS


onButton.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {

        if (edm == null) {
            edm = (EnterpriseDeviceManager) getSystemService(EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);
        LocationPolicy locationPolicy = edm.getLocationPolicy();

        try {
            boolean result = locationPolicy.startGPS(true);
            if(result == true){
                Log.d(LOG_TAG, "Start GPS success !!!");
                Log.d(LOG_TAG, "Start GPS success fail !!!");
        }catch(SecurityException e) {
            Log.w(LOG_TAG, "SecurityException: " + e);



When I click the button I get SecurityException: java.lang.SecurityException: No active admin owned by uid *****

here are my permissions from the manifest

<uses-permission android:name= "android.permission.sec.MDM_LICENSE" />
<uses-permission android:name="android.permission.sec.MDM_LOCATION" />
<uses-permission android:name="com.sec.enterprise.knox.permission.CUSTOM_SETTING"/>
<uses-permission android:name="com.sec.enterprise.knox.permission.CUSTOM_SYSTEM"/>
<uses-permission android:name="com.sec.enterprise.knox.permission.CUSTOM_PROKIOSK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Sorry but am not sure what I am missing.



Similar topics

No similar topics found.
Kieran McCormick
Mar 28, 2016
4:25 pm

Hi Doug,

Have you activated your application as a device administrator?


try {
   Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
   intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mDeviceAdmin);
   intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "Additional text explaining why this needs to be added.");
   startActivityForResult(intent, RESULT_ENABLE);
} catch (Exception e) {
   Log.w(TAG, "Exception: " + e);
   toast.setText("Error: Exception occurred - " + e);;