Skip to content
Snippets Groups Projects
Commit 4b2776d9 authored by Anon's avatar Anon
Browse files

Merge branch 'two-apps' into 'master'

Fix BLE callback issues

See merge request card10/companion-app-android!25
parents 68bdd85e 2995ccdf
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,11 @@ object ConnectionService {
}
fun connect(context: Context) {
if (isConnected()) {
gattListeners.values.map { it.onConnectionReady() }
return
}
// Use first BLE devices that is bonded
val bondedDevices = BluetoothAdapter.getDefaultAdapter().bondedDevices.filter {
it.address.startsWith(
......
......@@ -80,6 +80,11 @@ class MainFragment : Fragment(), GattListener {
private fun showConnectedView() {
// The callback can happen when our UI is not visible
if (container_connected == null) {
return
}
activity?.runOnUiThread {
container_connected.visibility = View.VISIBLE
container_disconnected.visibility = View.GONE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment