Android Question Admin does Not have android.permission

ykucuk

Well-Known Member
Licensed User
Longtime User
Hello,

I have a strange problem about permissions.

My application should have admin right for do some hardware restriction.

I have 3 devices.

-Samsung Galaxy S5 - android 6.01
-Samsung Galaxy Tab S - android 6.01
-Samsung Note 5 - android 7

Despite i have permissions in manifest file Tab S and Not 5 doesnt work and give error
B4X:
"java.lang.SecurityException: Admin  does not have android.permission.sec.MDM_KIOSK_MODE OR com.samsung.android.knox.permission.KNOX_KIOSK_MODE"

Galaxy S5 works fine.

My manifest file

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
AddPermission(android.permission.GET_ACCOUNTS)
AddPermission(android.permission.VIBRATE)
AddPermission(android.permission.READ_PHONE_STATE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddPermission(android.permission.CHANGE_WIFI_STATE)
AddPermission(android.permission.REBOOT)
AddPermission(android.permission.DUMP)
AddPermission(android.permission.BATTERY_STATS)
AddPermission(android.permission.KILL_BACKGROUND_PROCESSES)
AddPermission(android.permission.WRITE_SETTINGS)
AddPermission(android.permission.GET_TASKS)
AddPermission(android.permission.CAMERA)
AddPermission(android.permission.BLUETOOTH)
AddPermission(android.permission.BLUETOOTH_ADMIN)
AddPermission(android.permission.sec.MDM_HW_CONTROL)
AddPermission(android.permission.sec.MDM_APP_MGMT)
AddPermission(android.permission.sec.MDM_KIOSK_MODE)
AddPermission(com.android.launcher.permission.UNINSTALL_SHORTCUT)
AddPermission(android.permission.sec.MDM_RESTRICTION)
AddPermission(android.permission.sec.ENTERPRISE_DEVICE_ADMIN)
AddPermission(android.permission.sec.MDM_BLUETOOTH)
AddPermission(android.permission.sec.MDM_INVENTORY)
AddPermission(android.permission.sec.MDM_EXCHANGE)
AddPermission(android.permission.sec.MDM_ROAMING)
AddPermission(android.permission.sec.MDM_WIFI)
AddPermission(android.permission.sec.MDM_SECURITY)
AddPermission(android.permission.sec.MDM_LOCATION)
AddPermission(android.permission.sec.MDM_CALLING)
AddPermission(android.permission.sec.MDM_EMAIL)
AddPermission(android.permission.sec.MDM_VPN)
AddPermission(android.permission.sec.MDM_APN)
AddPermission(android.permission.sec.MDM_PHONE_RESTRICTION)
AddPermission(android.permission.sec.MDM_BROWSER_SETTINGS)
AddPermission(android.permission.sec.MDM_DATE_TIME)
AddPermission(android.permission.sec.MDM_ENTERPRISE_VPN)
AddPermission(android.permission.sec.MDM_FIREWALL)

AddApplicationText(<receiver android:name="anywheresoftware.b4a.objects.AdminReceiver2"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin"
 android:resource="@xml/device_admin" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>)
CreateResource(xml, device_admin.xml,
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<limit-password />
<reset-password />
<force-lock />
</uses-policies>
</device-admin>
)
 
Last edited:
Top