Language

BluetoothAdapter.Disable Method

Definition

Turn off the local Bluetooth adapter—do not use without explicit user action to turn off Bluetooth.

[Android.Runtime.Register("disable", "()Z", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool Disable();
[<Android.Runtime.Register("disable", "()Z", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.Disable : unit -> bool

Returns

true to indicate adapter shutdown has begun, or false on immediate error

Attributes

Remarks

Turn off the local Bluetooth adapter&mdash;do not use without explicit user action to turn off Bluetooth.

This gracefully shuts down all Bluetooth connections, stops Bluetooth system services, and powers down the underlying Bluetooth hardware.

Bluetooth should never be disabled without direct user consent. The Disable() method is provided only for applications that include a user interface for changing system settings, such as a "power manager" app.

This is an asynchronous call: it will return immediately, and clients should listen for ActionStateChanged to be notified of subsequent adapter state changes. If this call returns true, then the adapter state will immediately transition from On to TurningOff, and some time later transition to either Off or On. If this call returns false then there was an immediate problem that will prevent the adapter from being turned off - such as the adapter already being turned off.

This member is deprecated. Starting with Tiramisu, applications are not allowed to enable/disable Bluetooth. Compatibility Note: For applications targeting Tiramisu or above, this API will always fail and return false. If apps are targeting an older SDK (S or below), they can continue to use this API. <p>Deprecation Exemptions: <ul> <li>Device Owner (DO), Profile Owner (PO) and system apps. </ul>

Java documentation for android.bluetooth.BluetoothAdapter.disable().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to