I have a business application, which is only installed on authorized devices, now what I need is that the user cannot uninstall the application and that they cannot delete their data, similar to the factory applications of Google
. I have tried placing in the Manifest.xml
:
<uses-permission android:name="android.permission.BIND_DEVICE_ADMIN" />
But that marks me the following error when compiling:
Permission is only granted to system app
In this case, the applications that come pre-installed have the characteristic that is precisely commented on in the message when trying to use the permission:
The only way to prevent the user from uninstalling your app is for it to be created as a system app. However, it is important to note that it cannot be uninstalled but you cannot prevent certain data such as databases, accounts, settings, etc. from being deleted.
The process to create a system application in Android is documented in several places, but it is important to know that it can be of two types:
The second option is difficult for us developers since we do not have access to the key with which the firmware was signed .
I recommend you check:
https://forum.xda-developers.com/showthread.php?t=1776095
If you want to use the permission:
your app must be created as a system app , check the documentation for this permission: