我可以设置蓝牙PIN码从我的Andr​​oid应用程序 [英] Can I set the PIN for Bluetooth from my application in Android

查看:106
本文介绍了我可以设置蓝牙PIN码从我的Andr​​oid应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立在Android的支持蓝牙相关的应用程序。有没有什么办法通过,我可以比使用系统对话框输入引脚,弹出设置为从我的应用程序的PIN码的Andr​​oid等。我检查了由Android蓝牙API给出的,但作为无线管理器提供例如我无法找到设置蓝牙键任何API wificonfig。presharedkey = XYZ。

I wanted to build an application related to Bluetooth in Android . Is there any way by which I can set the PIN from my application in Android other than using system dialog box to enter PIN which pops out . I checked for API's given by Android for bluetooth, but I could not locate any API for setting keys for bluetooth as provided in WiFi manager e.g. wificonfig.presharedkey = xyz.

由于提前

推荐答案

使用公共API这是不可能的。
有几个原因,这是一个坏主意,
1.通过配对输入PIN与老蓝牙deices执行(一个或两个设备与蓝牙版本2.0或更小)
2.蓝牙2.1及以后将使用不同的机制进行配对,不得要求用户输入PIN相反,它可以显示用户一些/消息,并要求用户确认。

It is not possible using the public APIs. There are few reasons why this is a bad idea , 1. Pairing by entering PIN is performed with old bluetooth deices (one or both device with Bluetooth version 2.0 or lesser) 2. Bluetooth 2.1 and onwards will use different mechanism for pairing and may not require user to enter a PIN instead it can show user a number / message and ask for user's confirmation.

所以,如果您的应用程序工作在所有条件下最好是它使用系统提供的机制。 (提示用户输入PIN /确认等如适用)

So if your application has to work in all conditions it is better for it to use the system provided mechanism. (Which prompts the user for PIN / confirmation etc as applicable)

这篇关于我可以设置蓝牙PIN码从我的Andr​​oid应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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