BluetoothDevice.ConnectGatt 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
ConnectGatt(Context, Boolean, BluetoothGattCallback) |
Connect to GATT Server hosted by this device. |
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports) |
Connect to GATT Server hosted by this device. |
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, BluetoothPhy) |
Connect to GATT Server hosted by this device. |
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, ScanSettingsPhy) |
Obsolete.
|
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, BluetoothPhy, Handler) |
Connect to GATT Server hosted by this device. |
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, ScanSettingsPhy, Handler) |
Obsolete.
|
ConnectGatt(Context, Boolean, BluetoothGattCallback)
Connect to GATT Server hosted by this device.
[Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;)Landroid/bluetooth/BluetoothGatt;", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback);
[<Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;)Landroid/bluetooth/BluetoothGatt;", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback -> Android.Bluetooth.BluetoothGatt
Parameters
- context
- Context
- autoConnect
- Boolean
Whether to directly connect to the remote device (false) or to automatically connect as soon as the remote device becomes available (true).
- callback
- BluetoothGattCallback
GATT callback handler that will receive asynchronous callbacks.
Returns
- Attributes
Exceptions
if callback is null
Remarks
Connect to GATT Server hosted by this device. Caller acts as GATT client. The callback is used to deliver results to Caller, such as connection status as well as any further GATT client operations. The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct GATT client operations.
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
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports)
Connect to GATT Server hosted by this device.
[Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;I)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=23)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport);
[<Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;I)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=23)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports -> Android.Bluetooth.BluetoothGatt
Parameters
- context
- Context
- autoConnect
- Boolean
Whether to directly connect to the remote device (false) or to automatically connect as soon as the remote device becomes available (true).
- callback
- BluetoothGattCallback
GATT callback handler that will receive asynchronous callbacks.
- transport
- BluetoothTransports
preferred transport for GATT connections to remote dual-mode devices BluetoothDevice#TRANSPORT_AUTO
or BluetoothDevice#TRANSPORT_BREDR
or BluetoothDevice#TRANSPORT_LE
Returns
- Attributes
Remarks
Connect to GATT Server hosted by this device. Caller acts as GATT client. The callback is used to deliver results to Caller, such as connection status as well as any further GATT client operations. The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct GATT client operations.
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
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, BluetoothPhy)
Connect to GATT Server hosted by this device.
[Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;II)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=26)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport, Android.Bluetooth.BluetoothPhy phy);
[<Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;II)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=26)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports * Android.Bluetooth.BluetoothPhy -> Android.Bluetooth.BluetoothGatt
Parameters
- context
- Context
- autoConnect
- Boolean
Whether to directly connect to the remote device (false) or to automatically connect as soon as the remote device becomes available (true).
- callback
- BluetoothGattCallback
GATT callback handler that will receive asynchronous callbacks.
- transport
- BluetoothTransports
preferred transport for GATT connections to remote dual-mode devices BluetoothDevice#TRANSPORT_AUTO
or BluetoothDevice#TRANSPORT_BREDR
or BluetoothDevice#TRANSPORT_LE
- phy
- BluetoothPhy
preferred PHY for connections to remote LE device. Bitwise OR of any of BluetoothDevice#PHY_LE_1M_MASK
, BluetoothDevice#PHY_LE_2M_MASK
, and BluetoothDevice#PHY_LE_CODED_MASK
. This option does not take effect if autoConnect
is set to true.
Returns
- Attributes
Remarks
Connect to GATT Server hosted by this device. Caller acts as GATT client. The callback is used to deliver results to Caller, such as connection status as well as any further GATT client operations. The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct GATT client operations.
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
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, ScanSettingsPhy)
Caution
This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.
[System.Obsolete("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport, Android.Bluetooth.LE.ScanSettingsPhy phy);
[<System.Obsolete("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports * Android.Bluetooth.LE.ScanSettingsPhy -> Android.Bluetooth.BluetoothGatt
Parameters
- context
- Context
- autoConnect
- Boolean
- callback
- BluetoothGattCallback
- transport
- BluetoothTransports
- phy
- ScanSettingsPhy
Returns
- Attributes
Remarks
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
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, BluetoothPhy, Handler)
Connect to GATT Server hosted by this device.
[Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;IILandroid/os/Handler;)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=26)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport, Android.Bluetooth.BluetoothPhy phy, Android.OS.Handler? handler);
[<Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;IILandroid/os/Handler;)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=26)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports * Android.Bluetooth.BluetoothPhy * Android.OS.Handler -> Android.Bluetooth.BluetoothGatt
Parameters
- context
- Context
- autoConnect
- Boolean
Whether to directly connect to the remote device (false) or to automatically connect as soon as the remote device becomes available (true).
- callback
- BluetoothGattCallback
GATT callback handler that will receive asynchronous callbacks.
- transport
- BluetoothTransports
preferred transport for GATT connections to remote dual-mode devices BluetoothDevice#TRANSPORT_AUTO
or BluetoothDevice#TRANSPORT_BREDR
or BluetoothDevice#TRANSPORT_LE
- phy
- BluetoothPhy
preferred PHY for connections to remote LE device. Bitwise OR of any of BluetoothDevice#PHY_LE_1M_MASK
, BluetoothDevice#PHY_LE_2M_MASK
, an dBluetoothDevice#PHY_LE_CODED_MASK
. This option does not take effect if autoConnect
is set to true.
- handler
- Handler
The handler to use for the callback. If null
, callbacks will happen on
an un-specified background thread.
Returns
- Attributes
Remarks
Connect to GATT Server hosted by this device. Caller acts as GATT client. The callback is used to deliver results to Caller, such as connection status as well as any further GATT client operations. The method returns a BluetoothGatt instance. You can use BluetoothGatt to conduct GATT client operations.
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
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, ScanSettingsPhy, Handler)
Caution
This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.
[System.Obsolete("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport, Android.Bluetooth.LE.ScanSettingsPhy phy, Android.OS.Handler? handler);
[<System.Obsolete("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports * Android.Bluetooth.LE.ScanSettingsPhy * Android.OS.Handler -> Android.Bluetooth.BluetoothGatt
Parameters
- context
- Context
- autoConnect
- Boolean
- callback
- BluetoothGattCallback
- transport
- BluetoothTransports
- phy
- ScanSettingsPhy
- handler
- Handler
Returns
- Attributes
Remarks
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.