pavan
pavan

Reputation: 91

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

Upvotes: 6

Views: 1663

Answers (1)

Dennis Mathews
Dennis Mathews

Reputation: 6975

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)

Upvotes: 3

Related Questions