I want to ask a confirmation before disabling/deactivating device admin for my application. I searched a lot about it but not fing any proper solution for this.
In short, I want to detect a callback when user click DEACTIVATE button from device admin and I want to ask a confirmation to use that whether are you sure you want to deactivate device admin ? If use press cancel then device admin should not be deactivated.
If you observer AppLock application by DoMobile Lab from google play store, you can find that this app is doing the same thing. So there must be some secret behind it.
You can do it by overriding onDisableRequested() method of DeviceAdminReceiver
As per documentation
This will show a popup with OK and cancel button, along with the text returned.