Tested and working on Android 7.0 without root:
adb shell
dpm set-active-admin --user current com.company.foo.bar.package/.the.Admin.Reciever
To find the admin receiver of an installed package, use the following to adb shell command and review the output:
adb shell
pm dump com.company.foo.bar.package | grep ' filter' | cut -d ' ' -f 12 | sort | uniq
To give a real world example, here is the command used to activate IBM's Maas360 Android client as a device admin:
adb shell
pm dump com.fiberlink.maas360.android.control | grep ' filter' | cut -d ' ' -f 12 | sort | uniq
Output:
…
com.fiberlink.maas360.android.control/.receivers.GoogleCampaignReceiver
com.fiberlink.maas360.android.control/.receivers.LocalEventReceiver
com.fiberlink.maas360.android.control/.receivers.Maas360DeviceAdminReceiver <-- This is the one I want
com.fiberlink.maas360.android.control/.receivers.Maas360SecondaryDeviceAdminReceiver
…
Set Device Admin:
dpm set-active-admin --user current com.fiberlink.maas360.android.control/.receivers.Maas360DeviceAdminReceiver