1 本人需要将Android设备添加蓝牙音响功能,所以需要实现BluetoothA2dpSink,在开始前,已修改内容如下:
1)/package/app/bluetooth/res/value/config.xml
true
2) /system/bt/include/bt_target.h
#define BTA_AV_SINK_INCLUDE TRUE
2 代码如下
private void initBluetoothSink() {
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothAdapter.setName("ImiBluetooth");
if (!mBluetoothAdapter.isEnabled()) {
//弹出对话框提示用户是后打开
Intent enabler = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enabler, 1);
}
//获取A2DP代理对象
mBluetoothAdapter.getProfileProxy(this, mListener, BluetoothProfile.A2DP);
}
3 问题:
走到BluetoothSinkService.doBind()时一直
Log.e(TAG, "Could not bind to Bluetooth A2DP Service with " + intent);
也就是mContext.bindServiceAsUser(intent, mConnection, 0,
android.os.Process.myUserHandle())返回false
有没有大神面对过相关需求,及相应解决方案或思路?