简体   繁体   English

将android手机蓝牙与桌面连接鼠标和键盘访问

[英]Connect android mobile bluetooth with desktop for mouse and keyboard access

How to connect a bluetooth with desktop and android phone.如何连接蓝牙与台式机和 android 手机。 i able to parring and connect bluetooth but unable to connected with Mouse, keyboard & pen device type.我能够配对和连接蓝牙,但无法连接鼠标、键盘和笔设备类型。

Below given are both mobile device.下面给出的都是移动设备。 but A50 device connect using other app and i want to connect M30s as mouse, keyboard.但是 A50 设备使用其他应用程序连接,我想将 M30s 连接为鼠标、键盘。

在此处输入图像描述

private  class ConnectThread extends Thread {
        private final BluetoothSocket mmSocket;
        private final BluetoothDevice mmDevice;

        public ConnectThread(BluetoothDevice device) {
            BluetoothSocket tmp = null;
            mmDevice = device;
            try {
                tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
             
            } catch (IOException e) {
                e.printStackTrace();
            }
            mmSocket = tmp;
        }

        public void run() {
            btAdapter.cancelDiscovery();
            try {
                mmSocket.connect();
            } catch (IOException connectException) {
                try {
                    mmSocket.close();
                } catch (IOException closeException) { }
                return;
            }

            mHandler.obtainMessage(SUCCESS_CONNECT, mmSocket).sendToTarget();
        }


        public void cancel() {
            try {
                mmSocket.close();
            } catch (IOException e) { }
        }
}

Hope this helps希望这可以帮助

Nothing to post here as code is in github没有什么可以在这里发布的,因为代码在 github

Its in kotlin , convert to java using androidstudio它在kotlin中,使用 androidstudio转换java java

These one below are java but lacks/misses readme下面这些是java但缺少/错过自述文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM