Android的蓝牙 - 如何开始配对 [英] Android Bluetooth - How to initiate Pairing

查看:162
本文介绍了Android的蓝牙 - 如何开始配对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要发起配对请求(在这一点上的时间不连接)的非Android设备。这可以发现设置应用程序>网络>蓝牙设置工作>单击设备上扫描后。一个弹出出现都与6位引脚的设备。

I want to initiate a pairing request (not connection at this point of time) to a non android device. This can be found working on Settings Application > Network > Bluetooth Settings > Click on a device after scan. A pop up appears on both the devices with a 6 digit pin.

根据Android的文档,这应该在我的应用程序还冒出了为好,如果我做这样的事情。

As per Android's documentation this should have popped up in my application as well, if I do something like this

device.createRfcommSocketToServiceRecord(MY_UUID);

根据Android的API文档

As per Android's API documentation

一旦连接与制作
  首次,远程装置
  配对请求是自动
  presented给用户。

"Once a connection is made with a remote device for the first time, a pairing request is automatically presented to the user."

和它也提到

目前Android蓝牙API的
  需要之前配对设备
  RFCOMM连接可以被建立。
  (是自动进行的配对
  当你启动一个加密
  与蓝牙API的连接)。

"The current Android Bluetooth API's require devices to be paired before an RFCOMM connection can be established. (Pairing is automatically performed when you initiate an encrypted connection with the Bluetooth APIs.)"

甚至当我使用的示例蓝牙聊天应用程序(仅适用于测试是否启动在第一次连​​接配对),它并没有奏效。

Even when I used the sample Bluetooth Chat application (only to test if it initiates a pairing on first connection) it didn't worked.

我使用的是通用的UDID像00001101-0000-1000-8000-00805F9B34FB但无济于事还尝试。

I also tried using a generic UDID like "00001101-0000-1000-8000-00805F9B34FB" but to no avail.

找不到设置应用程序(Android操作系统2.1)的源$ C ​​$ C弄清楚自己。在Android的GIT可用的来源是为Android 2.3

Couldn't find the source code of Settings Application (Android OS 2.1) to figure out myself. The sources available in Android GIT were for Android 2.3

即使你不能回答这个问题,只是指出到Android包Android 2.1的设置应用来源可能做的伎俩对我来说。

推荐答案

这为我的作品与此UUID:00001101-0000-1000-8000-00805F9B34FB。
当你调用socket.connect()如果我没有记错的配对请求的意图启动。

It works for me with this UUID : "00001101-0000-1000-8000-00805F9B34FB". The intent for pairing request is launched when you call socket.connect() if I remember correctly.

这篇关于Android的蓝牙 - 如何开始配对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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