I have noticed that some devices have bluetooth enabled by default (after a factory reset) and some others don't.
In my Android Management API policy I would like to specify that bluetooth should be enabled.
I've tried setting bluetoothDisabled to false
but it doesn't have any effect: after provisioning the device bluetooth's status is the default one.
How can I force bluetooth to be enabled with Android Management API ?
The Android Management API doesn't offer to enable/disable Bluetooth directly at the moment.
However you can implement a companion app that controls the Bluetooth state through BluetoothAdapter
enable()
and disable()
methods. To do so:
android.permission.BLUETOOTH_ADMIN
) and launch it during setup:{
"applications": [
{
"packageName": "com.example.companion",
"installType": "REQUIRE_FOR_SETUP",
"defaultPermissionPolicy": "GRANT"
}
],
"setupActions":[
{
"launchApp":{
"packageName":"com.example.companion"
}
}
]
}
BluetoothAdapter
enable()
or disable()
as needed ApplicationPolicy.managedConfiguration
.You can also use the companion app for additional purposes if needed. Common use cases include: status page for your service, debug interface for admins, etc.