Can android policy manager be automatically activated as a device manager without user manual confirmation?

  android, question

Custom policy manager but the first run must be manually activated by the user. How to realize the program run detection whether it is activated as a device manager, and if not, automatically activated?

Can realize detection,

mDPManager.isAdminActive

However, silent activation cannot be enforced. Unless you have the permission of DeviceOwner or ProfileOwner (this permission can only be set to an application at the factory or modify the configuration file after root, so it is actually meaningless for general app).