We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I make automatic reconnection if the connection to the device is lost, and then reappeared?
The text was updated successfully, but these errors were encountered:
В TerminalFragment сделать что-то вроде этого:
public void onSerialIoError(Exception e) { status("connection lost: " + e.getMessage()); disconnect(); do { try { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); BluetoothDevice device = bluetoothAdapter.getRemoteDevice(deviceAddress); status("connecting..."); connected = Connected.Pending; SerialSocket socket = new SerialSocket(getActivity().getApplicationContext(), device); service.connect(socket); } catch (Exception ex) { SystemClock.sleep(250); continue; } } while(false); }
Sorry, something went wrong.
looks good, but instead of sleep I recommend postDelayed to not block the UI thread and a timeout + cancel button
sleep
postDelayed
Okay, I'll definitely try it.
No branches or pull requests
How can I make automatic reconnection if the connection to the device is lost, and then reappeared?
The text was updated successfully, but these errors were encountered: