KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been having this problem for a while and haven't been able to figure it out. I have an Android application that puts all paired devices in a listview. When you click one of the list items, it will initiate a request to connect to that Bluetooth device. I can get the list of devices with their addresses no problem. The problem is that once I try to connect I get an IOException on socket.connect(); The error message is as follows: connect read failed, socket might closed or timeout, read ret: -1 Here is my code. How can I fix this? FYI: the "onEvent" methods is a library that simplifies callbacks...that part works. When the user clicks on a list items, this method is called " public void onEvent(EventMessage.DeviceSelected event) ": public class EcoDashActivity extends BaseActivity { public static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); private BluetoothAdapter mBluetoothAdapter; private int REQUEST_ENABLE_BT = 100; private ArrayList<BluetoothDevice> mDevicesList; private BluetoothDeviceDialog mDialog; private ProgressDialog progressBar; private int progressBarStatus = 0; private Handler progressBarHandler = new Handler(); @Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); mDevicesList = new ArrayList<BluetoothDevice>(); // Register the BroadcastReceiver IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); registerReceiver(mReceiver, filter); setupBluetooth(); } private void setupBluetooth() { mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (mBluetoothAdapter == null) { // De
Tags (comma-separated)
Save Edits
Cancel