如何实现没有弹出一个对话框让用户permition一个Android的蓝牙配对? [英] How to implement a Android bluetooth paring without pop up a dialog to get a user permition?

查看:607
本文介绍了如何实现没有弹出一个对话框让用户permition一个Android的蓝牙配对?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些天,我实现蓝牙配对Android平台的功能,说具体为:
主设备是谷歌电视(3.2),从设备是蓝牙键盘,无一不是HID设备。
 键盘可以很容易地把中发现的状态,当电视启动第一次在电视设置向导,我需要让电视与键盘配对,
如你所知,在generall,能够在电视上一边蓝牙,我们需要获取用户permition,那么可以connect.Then我的问题happend是,我不想弹出一个对话框,获得permition,是有一些身体可以告诉我怎么办?

These days , i implement a blue tooth paring function on android platform,say in details: The master device is Google TV(3.2), the slave device is blue tooth keyboard,both are HID device. The Keyboard can be easily put in to discoverable status, When the TV bootup first time ,In TV setup guide, i need to let the tv paring with keyboard, As you know, in generall, enable bluetooth on TV side we need get the user permition, then can connect.Then my question happend is that i don't want to pop up a dialog to get permition, is there some body can tell me how to do ?

谢谢!

推荐答案

我发现了一个简单的方法 - 在Android code树,在外部\\蓝牙\\的bluez的\\ src \\ device.c

I found a simple way - in the Android code tree, in external\bluetooth\bluez\src\device.c:

/* If our IO capability is NoInputNoOutput use medium security
 * level (i.e. don't require MITM protection) else use high
 * security level */
if (capability == 0x03)
    sec_level = BT_IO_SEC_MEDIUM;
else
    sec_level = BT_IO_SEC_HIGH;


//david10000 add 
if (device_is_david10000_BTDEV(device)) {
    sec_level = BT_IO_SEC_MEDIUM;
}

这意味着我们可以低级别的​​安全性,让您的特殊装置自动连接。

This means we can low level the security to let your special device connect automatically.

另一种方法是可以将密钥/ PIN等,当你得到了Android对要求它进行编程,以自动填充。结果
如果你有这个问题,试试这个,它为我工作。

Another way is you can program it to auto fill the passkey/pin etc. when you get the Android pair request.
If you have this problem, try this, it works for me.

这篇关于如何实现没有弹出一个对话框让用户permition一个Android的蓝牙配对?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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