0

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 ?

sdabet
  • 18,360
  • 11
  • 89
  • 158
  • Hello, I found you with many questions with Android Enterprise. I have some basic questions. I searched a lot but didn't found proper solutions. I am developing a parental control app like Google Family Link for the child. Is it possible to develop an app like that using Android Enterprise? Can we disable/enable the app, lock/unlock devices using AE? Also, Can I track location, block/unblock all app installation and uninstallation? I found that we can manage only fully device or work profile only. So is it possible to develop this kind of app using Android Enterprise? – Chirag Savsani Jul 29 '19 at 13:13
  • @ChiragSavsani I am also interested in this question. Have you found the answer? – Владислав Стариков Aug 05 '20 at 07:32
  • @ВладиславСтариков See Fred's answer below – sdabet Aug 05 '20 at 08:28

1 Answers1

0

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:

  1. Create an Android app (the "companion" app) and upload it to Play (possibly as a private app)
  2. Set a policy to force install this app, grant it all permissions (so it gets the permission 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"
         }
      }
   ]
}
  1. When the companion app launches call BluetoothAdapter enable() or disable() as needed
  2. (Optional) Implement managed configurations in the companion app to be able to configure it from the Android Management API via 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.

Fred
  • 2,191
  • 1
  • 12
  • 14