连接到非发现的蓝牙设备 [英] connect to non-discoverable bluetooth device

查看:211
本文介绍了连接到非发现的蓝牙设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Android开发的应用程序。只是一个一般的问题,即,如果是能够连接到一个装置,该装置的非可发现的公开

I am developing an app for android. Just a general questions as to , if is it possible to connect to a device which is non discoverable publicly?

在此先感谢。

推荐答案

如果您有previously配对的设备,然后就可以连接到它再次,即使它是不是在发现模式。看到这个帖子: <一href="http://stackoverflow.com/questions/5171248/programmatically-connect-to-paired-bluetooth-device">programmatically-connect-to-paired-bluetooth-device

If you have previously paired with the device then it is possible to connect to it again even if it is not in discoverable mode. See this post: programmatically-connect-to-paired-bluetooth-device

    // use paired devices or create a BluetoothDevice using a mac address
    //Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
    BluetoothAdapter myAdapter = BluetoothAdapter.getDefaultAdapter();
    BluetoothDevice remoteDevice = myAdapter.getRemoteDevice("00:00:00:00:00:00");
    BluetoothSockt btSocket = remoteDevice.createRfcommSocketToServiceRecord(UUID);
    btSocket.connect();
    //get input and output stream etc...

这篇关于连接到非发现的蓝牙设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆