开发者

Can I set the PIN for Bluetooth from my application in Android

开发者 https://www.devze.com 2023-01-09 03:23 出处:网络
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 ent

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.

Thanks in Advance


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.

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号