Language

BluetoothHeadset.GetCodecType(BluetoothDevice) Method

Definition

Get the codec type of the given HFP connected device.

[Android.Runtime.Register("getCodecType", "(Landroid/bluetooth/BluetoothDevice;)I", "", ApiSince=37)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothHeadsetCodecType GetCodecType(Android.Bluetooth.BluetoothDevice device);
[<Android.Runtime.Register("getCodecType", "(Landroid/bluetooth/BluetoothDevice;)I", "", ApiSince=37)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.GetCodecType : Android.Bluetooth.BluetoothDevice -> Android.Bluetooth.BluetoothHeadsetCodecType

Parameters

device
BluetoothDevice

The remote Bluetooth device. Must not be null.

Returns

The codec type of the given HFP connected device. Returns #CODEC_TYPE_UNSUPPORTED if Bluetooth is off, the profile is not connected, the device is not connected, the codec negotiation is not completed, or an error occurs.

Attributes

Remarks

Get the codec type of the given HFP connected device.

This method returns the codec type that has been negotiated between the AG and HF which is available once the HFP SLC is established and the codec negotiation process is completed. The negotiated codec can be retrieved regardless of whether a SCO audio connection is currently active or not. 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.BluetoothHeadset.getCodecType.

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