需要的权限
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
关于监听蓝牙连接状态的action
public final static String ACL_CONNECTED = "android.bluetooth.device.action.ACL_CONNECTED";
public final static String ACL_DISCONNECTED = "android.bluetooth.device.action.ACL_DISCONNECTED";
AudioManager.SCO_AUDIO_STATE_CONNECTED
AudioManager.SCO_AUDIO_STATE_DISCONNECTED
举例:
//注册监听蓝牙sco状态
filter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED);
public void execReceiverFromScoState(String action , Intent intent){
if(ac