My android app requires connecting to a bluetooth printer (Zebra Bt Printer) to print tickets, this printer doesn't require authentication (it's set Authentication:OFF), but i cant create a connection with it because the app asks to make pairing by entering a pin, i've tried default values like 0000 and 1234 but any of them works.
This is the code i use to create a connection with the printer:
Set<BluetoothDevice> devices = bluetoothAdapter.getBondedDevices();
for (BluetoothDevice device : devices) {
if (device.getAddress().equals(PRINTER_DEVICE_MAC_ADDRESS)) {
bluetoothDevice = bluetoothAdapter.getRemoteDevice(PRINTER_DEVICE_MAC_ADDRESS);
if (bluetoothDevice != null) {
try {
clientSocket = bluetoothDevice.createRfcommSocketToServiceRecord(uuid);
clientSocket.connect();
} catch (IOException e) {
e.printStackTrace();
}
}
}
When it executes the line :
clientSocket.connect();
is where appears the dialog for entering the pin for making the connection with the device, but i dont know what code to enter or how to avoid this dialog.
-I'm using Galaxy Tab 3 with Android 4.1.2 -Developing in Api 14