I have a Kiosk app based on https://www.b4x.com/android/forum/threads/device-owner-tasklock-kiosk-apps-2017.81765/. It is set as the Device Owner and the Home Launcher.
At the end of a shift the user needs to upload the data they have collected to a PC via Bluetooth which isn't a problem if the device has already been paired. But because this is a kiosk app the dialogs to initially pair the phone with the PC are not visible so pairing without a passkey or user confirmation is necessary.
Erel's code at https://www.b4x.com/android/forum/threads/hidden-bluetooth-pairing-notification.79196/#post-730621 came close to a solution but complained of a missing permission ("android.permission.BLUETOOTH_PRIVILEGED"). I added that in the manifest and requested the permission in code but it still throws an error: "java.lang.SecurityException: Need BLUETOOTH PRIVILEGED permission: Neither user 10264 nor current process has android.permission.BLUETOOTH_PRIVILEGED." I tried running "adb shell pm grant my_package_name_here android.permission.BLUETOOTH_PRIVILEGED" in a CMD window but adb would not set it.