bluetoothviewer
bluetoothviewer copied to clipboard
Should handle connection errors more gracefully
When connecting to an invalid channel, the app crashes. This is because the connection fails in the constructor of ConnectThread, but the caller doesn't check that, and hits an NPE when trying to use the socket.
- It would be better to avoid work (= initialize socket) in the constructor of
ConnectThread, which is a bad practice - The caller should handle problems like this gracefully
Perhaps the connection can be done synchronously.
...And instead of logging an exception, the app could show more details of why the connection attempt failed.
...And offer to retry all channels.
...And offer other troubleshooting tips, or explanations, what the user could try, or why it cannot possibly work.