In android application we are using Bluetooth connectivity with some of medical devices.
To do this we have used below code
BluetoothDevice zee = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(bluetoothAddress);
Method m = (Method) zee.getClass().getMethod("createRfcommSocket",new Class[] { int.class });
result = (BluetoothSocket) m.invoke(zee, Integer.valueOf(1));
or some condition, if the above code get failed then we use below code
String bluetooth_address="";
bluetooth_address=bluetoothAddress;
BluetoothDevice zee = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(bluetooth_address);
result = zee.createRfcommSocketToServiceRecord( getSerialPortUUID() );
both codes are working fine up to 4.0 android OS.
But on Android OS 4.1.1 it is now getting issue like “Connection Refused”.
Please help.
Thanks all, I solved this issue by calling insecure RF comm Socket like