Saturday, August 13, 2011

[android-developers] how to detect an invalid pin was given by the user when connecting to bluetooth

Hi,

I'm implementing bluetooth support for my application. When i try to
connect to the device, Android shows me the dialog that asks for the
pin.

Now i have two questions:

1. How to detect that the dialog was closed? The user could press
cancel, and i need to detect this

2. How to detect that the password was wrong? I realized during the
tests that if the user enters a wrong password, i receive an
IOException with "unable to find services" (or something like this).
If the pin is correct, this exception is not thrown. Isn't there a
better way?

Also, even if a wrong password is given, the device is added to the
BONDED list, and can be retrieved with the
BluetoothAdapter.getBondedDevices.

I'm using an Android 2.2.1 device and a Zebra printer with bluetooth
2.0 specification.

Any help is appreciated,

guich

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment