Can I set a PIN for Bluetooth from my Android app?

I wanted to create a bluetooth related app in Android. Is there a way by which I can set the PIN from my Android application, other than the system dialog, to enter the PIN that appears. I checked the API provided by Android for bluetooth, but I could not find any API for setting bluetooth keys, as provided in the WiFi manager, for example. wificonfig.presharedkey = xyz.

Thanks at Advance

+6
android bluetooth
source share
1 answer

Cannot use public APIs. There are several reasons why this is a bad idea: 1. Pairing by entering a PIN code is performed with old bluetooth settings (one or both devices with Bluetooth version 2.0 or less) 2. Bluetooth 2.1 and later will use a different mechanism for pairing and may not require from the user entering a PIN code, instead he can show the user a number / message and ask for user confirmation.

So, if your application should work in all conditions, it is better to use the mechanism provided by the system. (What prompts the user with PIN / confirmation, etc.)

+3
source share

All Articles