Share via


AudioManager.StartBluetoothSco Method

Definition

Start bluetooth SCO audio connection.

[Android.Runtime.Register("startBluetoothSco", "()V", "GetStartBluetoothScoHandler")]
public virtual void StartBluetoothSco ();
[<Android.Runtime.Register("startBluetoothSco", "()V", "GetStartBluetoothScoHandler")>]
abstract member StartBluetoothSco : unit -> unit
override this.StartBluetoothSco : unit -> unit
Attributes

Remarks

Start bluetooth SCO audio connection.

Requires Permission: Manifest.permission#MODIFY_AUDIO_SETTINGS.

This method can be used by applications wanting to send and received audio to/from a bluetooth SCO headset while the phone is not in call.

As the SCO connection establishment can take several seconds, applications should not rely on the connection to be available when the method returns but instead register to receive the intent #ACTION_SCO_AUDIO_STATE_UPDATED and wait for the state to be #SCO_AUDIO_STATE_CONNECTED.

As the ACTION_SCO_AUDIO_STATE_UPDATED intent is sticky, the application can check the SCO audio state before calling startBluetoothSco() by reading the intent returned by the receiver registration. If the state is already CONNECTED, no state change will be received via the intent after calling startBluetoothSco(). It is however useful to call startBluetoothSco() so that the connection stays active in case the current initiator stops the connection.

Unless the connection is already active as described above, the state will always transition from DISCONNECTED to CONNECTING and then either to CONNECTED if the connection succeeds or back to DISCONNECTED if the connection fails (e.g no headset is connected).

When finished with the SCO connection or if the establishment fails, the application must call #stopBluetoothSco() to clear the request and turn down the bluetooth connection.

Even if a SCO connection is established, the following restrictions apply on audio output streams so that they can be routed to SCO headset: <ul> <li> the stream type must be #STREAM_VOICE_CALL</li> <li> the format must be mono </li> <li> the sampling must be 16kHz or 8kHz </li> </ul>

The following restrictions apply on input streams: <ul> <li> the format must be mono </li> <li> the sampling must be 8kHz </li> </ul>

Note that the phone application always has the priority on the usage of the SCO connection for telephony. If this method is called while the phone is in call it will be ignored. Similarly, if a call is received or sent while an application is using the SCO connection, the connection will be lost for the application and NOT returned automatically when the call ends.

NOTE: up to and including API version android.os.Build.VERSION_CODES#JELLY_BEAN_MR1, this method initiates a virtual voice call to the bluetooth headset. After API version android.os.Build.VERSION_CODES#JELLY_BEAN_MR2 only a raw SCO audio connection is established.

This member is deprecated. Use AudioManager#setCommunicationDevice(AudioDeviceInfo) instead.

Java documentation for android.media.AudioManager.startBluetoothSco().

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

See also