BluetoothDevice.CreateBond Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| CreateBond() |
Start the bonding (pairing) process with the remote device. |
| CreateBond(Int32) |
Start the bonding (pairing) process with the remote device using the specified transport. |
CreateBond()
Start the bonding (pairing) process with the remote device.
[Android.Runtime.Register("createBond", "()Z", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool CreateBond();
[<Android.Runtime.Register("createBond", "()Z", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.CreateBond : unit -> bool
Returns
false on immediate error, true if bonding will begin
- Attributes
Remarks
Start the bonding (pairing) process with the remote device.
This is an asynchronous call, it will return immediately. Register for #ACTION_BOND_STATE_CHANGED intents to be notified when the bonding process completes, and its result.
Android system services will handle the necessary user interactions to confirm and complete the bonding process.
Java documentation for android.bluetooth.BluetoothDevice.createBond().
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
CreateBond(Int32)
Start the bonding (pairing) process with the remote device using the specified transport.
[Android.Runtime.Register("createBond", "(I)Z", "", ApiSince=37)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public bool CreateBond(int transport);
[<Android.Runtime.Register("createBond", "(I)Z", "", ApiSince=37)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.CreateBond : int -> bool
Parameters
- transport
- Int32
The transport to use for the pairing procedure.
Returns
false on immediate error, true if bonding will begin
- Attributes
Remarks
Start the bonding (pairing) process with the remote device using the specified transport.
This is an asynchronous call, it will return immediately. Register for ACTION_BOND_STATE_CHANGED intents to be notified when the bonding process completes, and its result.
Android system services will handle the necessary user interactions to confirm and complete the bonding process. For apps targeting Build.VERSION_CODES.R or lower, this requires the Manifest.permission.BLUETOOTH_ADMIN permission which can be gained with a simple <uses-permission> manifest tag. For apps targeting Build.VERSION_CODES.S or or higher, this requires the Manifest.permission.BLUETOOTH_CONNECT permission which can be gained with android.app.Activity.requestPermissions(String[],int). Requires Manifest.permission.BLUETOOTH_CONNECT
Android reference for android.bluetooth.BluetoothDevice.createBond.
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.