How to connect to Raspberry pi with an android app over bluetooth

后端 未结 4 1758
Happy的楠姐
Happy的楠姐 2021-01-31 06:31

I\'m having trouble connecting my smartphone to my raspberry pi over bluetooth using an app.

My situation:

I\'m developing a bluetooth controlla

4条回答
  •  忘掉有多难
    2021-01-31 07:05

    I think linux use bluetooth need specify the connect port.

          try {
                Method m = remoteDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
                try {
                    BluetoothSocket tmp = (BluetoothSocket)m.invoke(remoteDevice, 1);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                }
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }
    

提交回复
热议问题