0

I have a problem in Android Bluetooth connection. I have a bluetooth device connected to the phone. The device will send data to the phone every 10 seconds.

Android Firmware version below 4.4.2 has no problem in sending data and bluetooth connection. Android Firmware version above 4.4.2 keep disconnecting every 10 seconds or more. Is this the Android problem or my programming problem ?

4

1 回答 1

0

在我的编程代码下方。当我在 Android 手机固件版本 4.4.2 及更高版本上进行测试时,它不断收到 ACTION_ACL_CONNECTED。Android 手机固件版本低于 4.4.2 工作正常。

private final BroadcastReceiver mReceiver = new BroadcastReceiver() 
{
@Override
public void onReceive(Context context, Intent intent) 
{
String action = intent.getAction();

if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) 
{
Log.d("MainActivity","Bluetooth connected.");
}
else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) 
{
Log.d("MainActivity","Bluetooth disconnected.");    
}else{
Toast.makeText(context, action, Toast.LENGTH_LONG).show();
}
}
};
于 2015-02-25T16:37:31.107 回答