Android Bluetooth socket freeze application

后端 未结 6 2377
南旧
南旧 2021-02-14 23:46

I have a strange issue with bluetooth socket. If I create socket and later close application, android device freeze with very hight CPU load.

Here my sample code:

<
6条回答
  •  你的背包
    2021-02-15 00:09

    A solution I found working (for a samsung galaxy mini) - that is quite unfriendly to the user, and not good "design" (but the broadcom firmware bug is not good "design" anyway) - but it's better than letting the user's phone freeze - is to turn OFF the bluetooth after we're done:

    In both my onDestroy() and onBackPressed() - I call my cleanup() function that has something like this:

    if(mBluetoothAdapter != null)
    {           
    mBluetoothAdapter.disable();            
    }    
    mBluetoothAdapter = null;
    

提交回复
热议问题