Closed eric-nextsense closed 3 years ago
On older Samsung phones it is necessary to do all GATT operations on the main thread. I guess it not necessary for modern phones but it also doesn't hurt I think.
Is it causing you trouble?
That is interesting to know about older Samsung phones!
I have an application where the connection should be closed correctly before exiting, so I wrapped the callback in a Java Future. If I listen to the future it works fine, but if I try to do a get() in the main thread to confirm it was done then it hangs. Not a huge deal. I could just launch the disconnect and not worry but it felt cleaner.
On Sat, Aug 7, 2021 at 11:15 PM Martijn van Welie @.***> wrote:
On older Samsung phones it is necessary to do all GATT operations on the main thread. I guess it not necessary for modern phones but it also doesn't hurt I think.
Is it causing you trouble?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/weliem/blessed-android/issues/109#issuecomment-894674243, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASYWBYS54IIYXGEFDH7ZC5TT3VLYRANCNFSM5BV32IMQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
I noticed that when you do operations on a BluetoothPeripheral like cancelConnection(), it posts on the mainHandler (Main looper) and there is no way to change this.
Could you explain why it uses the main looper only here? Would it be possible to provide your own handler instead? If ok i do not mind doing a pull request with the change.