简体   繁体   English

防止卸载和恢复出厂设置android

[英]Prevent uninstall and factory reset android

I have tried to search for it but couldn't find a proper solution.我试图搜索它,但找不到合适的解决方案。 So Posting question here to seek help.所以在这里发帖寻求帮助。

Our essential requirement is that child cannot uninstall the app or cannot perform a factory reset on the device without admin permission.我们的基本要求是孩子不能卸载应用程序或未经管理员许可不能在设备上执行恢复出厂设置。 Basically similar to the Family Link app .基本上类似于Family Link 应用程序

We are unsure how to make this possible and looking for an expert to help us out with this.我们不确定如何使这成为可能,并正在寻找专家来帮助我们解决这个问题。

Use of Device Admin have been deprecated and Android provides very limited functionality starting from Android 10. Application management permissions are part of Device Owner and Profile Owner deployment models in Android.设备管理员的使用已被弃用,并且从 Android 10 开始,Android 提供的功能非常有限。应用程序管理权限是 Android 中设备所有者和配置文件所有者部署模型的一部分。 You need to set your app as Device Owner, use below API :您需要将您的应用设置为设备所有者,使用以下 API:

For blocking Application uninstallation: https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setUninstallBlocked(android.content.ComponentName,%20java.lang.String,%20boolean)对于阻止应用程序卸载: https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setUninstallBlocked(android.content.ComponentName,%20java.lang.String,%20boolean)

To prevent Factory Reset : https://developer.android.com/reference/android/os/UserManager#DISALLOW_FACTORY_RESET为了防止恢复出厂设置: https ://developer.android.com/reference/android/os/UserManager#DISALLOW_FACTORY_RESET

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM