gpt4 book ai didi

Android JB 广播接收器不接收 bluetooth.android.bluetooth.BluetoothDevice.ACTION_ACL_CONNECTED

转载 作者:行者123 更新时间:2023-11-29 18:08:21 28 4
gpt4 key购买 nike

我正在使用运行 jb 的 root 三星 galaxy nexus 手机,由于某种原因,我没有从蓝牙连接服务接收到任何广播 Intent 。您将在下面找到我的接收器 list 和广播接收器代码。任何提示或想法将不胜感激。

谢谢

这是 list

<receiver android:name=".ABroadcastReciever" >
<intent-filter>
<action android:name="android.bluetooth.BluetoothDevice.ACTION_ACL_CONNECTED" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECTED" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_BOND_STATE_CHANGED" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_FOUND" />
<action android:name="android.bluetooth.BluetoothDevice.BOND_BONDING" />
<action android:name="android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>

这是接收者

public void onReceive(Context context, Intent intent) { 
String action = intent.getAction();

//This is looking for the Wifi Connectivity Changes
if(action.equals("android.net.conn.CONNECTIVITY_CHANGE")){
Log.d(TAG,"received: Wifi Connection Change");
}
//This is looking Bluetooth connection disconnect
else if(action.equals("android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECTED") ||
action.equals("android.bluetooth.BluetoothDevice.ACTION_ACL_DISCONNECTED_REQUESTED") ){
Log.d(TAG,"Received: Bluetooth Disconnected");

}
//This is looking for Bluetooth connection established
else if(action.equals("android.bluetooth.BluetoothDevice.ACTION_ACL_CONNECTED")){
Log.d(TAG,"Received: Bluetooth Connected");
}
}

最佳答案

这是正在广播的新 Intent 。

<action android:name="android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED" />

感谢关注这是新的 Intent

关于Android JB 广播接收器不接收 bluetooth.android.bluetooth.BluetoothDevice.ACTION_ACL_CONNECTED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12168874/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com