I'm a beginner in Android programming since I only started 3 months ago. I'm doing a project which connects the android app to arduino using bluetooth. I already have a code for the android app (bluetooth.adapter,sockets,.etc.). The code for connection is already working. One of the goal is for the android app to automatically input the password when pairing with the bluetooth device without asking user to input the PIN.
The old posts on this forum do not help much. (many suggested using insecure mode, but I do need secure mode, also in my case, the arduino is the server while cellphone app is the client, so the createInsecureRfcommSocketToServiceRecord() server method does not work for me)
I searched and found this in android developer site about bluetoothdevice class:
setPairingConfirmation(boolean confirm) Confirm passkey for PAIRING_VARIANT_PASSKEY_CONFIRMATION pairing.
PAIRING_VARIANT_PIN = "The user will be prompted to enter a pin or an app will enter a pin for user".
PAIRING_VARIANT_PASSKEY_CONFIRMATION = "The user will be prompted to confirm the passkey displayed on the screen or an app will confirm the passkey for the user"
Seems using the code, the app will be the one to input the password and confirm the password making it an "auto-connect" features but the android site does not give a sample code on how to use this. Does any of you have a sample code in using this or related process? I appreciate your help!