Android Bluetooth connection issue

前端 未结 2 403
北恋
北恋 2021-02-02 00:55

I try to set up a Bluetooth connection as follows:

private class ConnectThread extends Thread {

    private final BluetoothSocket mmSocket;
    private final Bl         


        
2条回答
  •  心在旅途
    2021-02-02 01:18

    I had a very similar problem some days ago...

    Try adding this check to your code:

    if(mmInStream.available() > 0){
       bytes = mmInStream.read(buffer);
       mHandler.obtainMessage(MESSAGE_WRITE, -1, -1, buffer).sendToTarget();
    }
    

    This fixed my problem...

    Good Luck ;)

提交回复
热议问题