Home Ask Login Register

Developers Planet

Your answer is one click away!

Glenn Arens February 2016

SetPin return false on android but no exception

When I try to use SetPin on a bluetooth device it returns false. but according to http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html if it returns false it should display an error. Any ideas? my code is down here.

   pin = (byte[]) BluetoothDevice.class.getMethod("convertPinToBytes", String.class).invoke(BluetoothDevice.class, "4711");
            boolean check = CurrentDevice.setPin(pin);
            int test = CurrentDevice.getBondState();


spaceplane February 2016

According to http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#setPin(byte[]):

public boolean setPin(byte<> pin) 

Returns: true pin has been set false for error

There is no mention of an exception and so if you are not getting one your code is behaving correctly.

Post Status

Asked in February 2016
Viewed 2,480 times
Voted 14
Answered 1 times


Leave an answer

Quote of the day: live life