Stanislav Bondar
Stanislav Bondar

Reputation: 6265

Disable Wipe data & factory reset

I'm developing application that provides child protection(blocking obscene contents, apps, etc.) kind of kiosk mode. And i want to disable factory reset. I found solution using Samsung KNOX SDK (for Samsung devices only) that provide to block factory reset and even wipe data from boot menu. But using other device i'm able only block screen with AccessibilityService when user opens factory reset settings. Does exsist SDK or built-in abbility to disable wipe data for all devices?
Thanks in advance

Upvotes: 1

Views: 10687

Answers (3)

manoellribeiro
manoellribeiro

Reputation: 274

Fred's answer is correct, but if you want some code:

val devicePolicyManager = context.getSystemService(
            Context.DEVICE_POLICY_SERVICE
        ) as DevicePolicyManager

devicePolicyManager.addUserRestriction(
        ComponentName(context.applicationContext, MyDeviceAdminReceiver::class.java),
        UserManager.DISALLOW_FACTORY_RESET
    )

MyDeviceAdminReceiver is the class you extended DeviceAdminReceiver when setuping your application to be a Device Owner.

Upvotes: 1

Routerdieb
Routerdieb

Reputation: 59

You can set device managment through adb, then you don't need to full reset your phone. See the Sourcecode and tutorial on TestDPC for help.

Upvotes: 0

Fred
Fred

Reputation: 2251

You can use the Android Management API to manage your device and set factoryResetDisabled to true in the device's Policy. This API supports any device running Android 5.1 or above.

Under the hood the Android Management API sets the DISALLOW_FACTORY_RESET restriction, which can only be set by a device owner or profile owner.

Upvotes: 2

Related Questions