Bluetooth not connecting on 4.4.2

前端 未结 2 1382
温柔的废话
温柔的废话 2020-12-29 22:37

I\'ve got a Bluetooth device that has connected on all versions of Android that I have tried prior to 4.4.2. Now, it\'s not connecting on the Galaxy Tab 4 or the S3. The Tab

2条回答
  •  轮回少年
    2020-12-29 23:17

    I have also used connection steps using the same code but that could work only for Smart Android device.

    you can get the BluetoothDevice object of the particular device you want to connect. after that you can use BluetoothHeadset's connect and disconnect method via reflection to connect to the perticular BluetoothDevice.

    Class BTHeadset = Class.forName("android.bluetooth.BluetoothHeadset");
            Method conn = BTHeadset.getMethod("connect", new Class[] {BluetoothDevice.class});
                   conn.invoke(BTHeadset, new Object[] {btDev});
    

    same code you can use for disconneting a device using disconnect method via reflection.

提交回复
热议问题