Yes, provided that you've root access. You would have to add the app's receiver and the policy flag in the file /data/system/device_policies.xml
. For example, to enable Tasker as Device administrator add the following lines in the said file,
For Android 5.x: Remove the last line with </policies>
if there is already a Device Administrator enabled in the system. Simply add the lines in the file after the line with string <policies setup-complete="true">
.
<admin name="net.dinglisch.android.taskerm/net.dinglisch.android.taskerm.MyDeviceAdminReceiver">
<policies flags="8" />
</admin>
</policies>
For Android 4.2.1: Remove the last line with </policies>
if there is already a Device Administrator enabled in the system. Simply add the lines in the file after the line with string <policies>
.
<admin name="net.dinglisch.android.taskerm/net.dinglisch.android.taskerm.MyDeviceAdminReceiver">
<policies flags="8" />
</admin>
</policies>
Reboot the device for the changes to take effect.
(Busybox required) You can use sed
or echo
or any command that you're comfortable with to write the file with those lines. For any help, see my answer here: How to enable device administrator for specific apps using Tasker?How to enable device administrator for specific apps using Tasker?