Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 920
pavan Avatar asked Jul 29 '10 08:07

pavan


1 Answers

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)

like image 115
Dennis Mathews Avatar answered Sep 30 '22 11:09

Dennis Mathews