-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VBLOCKS-2801 bluetooth listener (#159)
* BluetoothHeadsetConnectionListener can now be added to monitor bluetooth state * Update CHANGELOG.md and README.md * Update tests * Spotless check * Listen to Bluetooth sco state changes and add onBluetoothScoStateChanged * Update tests
- Loading branch information
Showing
13 changed files
with
148 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 22 additions & 2 deletions
24
...itch/src/main/java/com/twilio/audioswitch/bluetooth/BluetoothHeadsetConnectionListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
package com.twilio.audioswitch.bluetooth | ||
|
||
internal interface BluetoothHeadsetConnectionListener { | ||
fun onBluetoothHeadsetStateChanged(headsetName: String? = null) | ||
import android.bluetooth.BluetoothHeadset | ||
import android.media.AudioManager | ||
|
||
/** | ||
* Notifies if Bluetooth device state has changed (connect, disconnect, audio connect, audio disconnect) or failed to connect. | ||
*/ | ||
interface BluetoothHeadsetConnectionListener { | ||
|
||
/** | ||
* @param headsetName name of the headset | ||
* @param state provided by [BluetoothHeadset] | ||
*/ | ||
fun onBluetoothHeadsetStateChanged(headsetName: String? = null, state: Int = 0) | ||
|
||
/** | ||
* @param state provided by [AudioManager] | ||
*/ | ||
fun onBluetoothScoStateChanged(state: Int = 0) | ||
|
||
/** | ||
* Triggered when Bluetooth SCO job has timed out. | ||
*/ | ||
fun onBluetoothHeadsetActivationError() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.