TCNCoalition/tcn-client-android

Threading issues and multiple object issues.

acooley opened this issue · 0 comments

Since you are using AlarmManager you need a singleton with proper synchronization to represent your BLE 'device'. If you don't have that you'll run in to some really strange issues, particularly on older devices, if the library is used aggressively. Basically you need to make sure that only one thread ever interacts with the Bluetooth subsystem from your app. This happens naturally if you use the app from the foreground, but as soon as you introduce background stuff you need a Kotlin object or other form of singleton and you need to synchronize on it.