I want to use some DevicePolicyManager methods in my app. The DevicePolicyManager was introduced in OS 2.2, but my app must continue to run on OS 2.1 devices.
Here\'s
If I need to implement a DeviceAdminReceiver, will reflection work?
Not really. You'd need to use conditional class loading, which means you may as well just go that route to begin with.
Is anybody aware of any drawbacks or complications to it?
Speaking on behalf of my little corner of "anybody", I'm not aware of any drawbacks. I'd use the VERSION_CODES
constants on Build
, though, rather than the integer (7
). And, unless you're supporting 1.5, you can use SDK_INT
on Build
rather than SDK
.
Would you recommend reflection or conditional class loading for using DevicePolicyManager?
Conditional class loading.
Will I need a DeviceAdminReceiver, or can I detect whether the user has a suitable password, e.g. by repeatedly calling isActivePasswordSufficient in my app to confirm it has been done?
That I can't answer. If you don't get another answer addressing this point, you might consider asking that in its own SO question.
Any other tips if you have them
Never get involved in a land war in Asia.