How do DeviceAdminReceivers work?
I'm a little confused by device admin receivers.
Once the user enables them, is any instance of the class able to perform administrative functions like locking the screen? Or does the system instantiate it's开发者_如何学Go own copy?
Finally, is there any time when they must be reenabled?
Enabling a device admin allows any code in that admin's application (apk) to access the functionality it has been given.
The DeviceAdminReceiver class is how the platform communicates to your app. A new instance is created each time a communication is made to it. Your interaction back with the platform is done by calls to DevicePolicyManager, which any part of your code can retrieve with Context.getSystemService(). There are just a set of convenience methods on DeviceAdminReceiver for accessing and interacting with the DevicePolicyManager because... well it's convenient.
I don't know what you mean by your question "is there any time when they must be reenabled."
精彩评论