We have an App MaaS360 for Android which is an Device Administrator (Device Administration | Android Developers ).
When we install the app we get a activity titled "Activate device administrator" to set app has Device Administrator. With Activate and Cancel button. Once done app will be set as Device Administrator.
The above step is manual, in which user has to select Activate button. To automate this or set the app has Device Administrator without user consent using DevAdmin CSP Device Admin - Zebra Technologies Techdocs.
Moving forward to make app Device Administrator we have to provide some information <uses-policies> in xml for which we required Device Administrator privilege (Device Administration | Android Developers )
There are the 2 cases in which one is successful and other in which CSP is not able to set Device Administrator due to one parm in xml called "visibility".
Attaching zip with detail description containing sample apps and other details.