https://kotlinlang.org logo
#coroutines
Title
# coroutines
b

bj0

02/01/2018, 6:20 PM
@elizarov the other day someone said
withContext(UI) { }
was equivalent to
async(UI) { }.await()
, but I am having serious problems with the latter, was that not the case?
l

louiscad

02/01/2018, 6:50 PM
@bj0 What "serious issues" do you have with async + await ?
b

bj0

02/01/2018, 6:53 PM
the other way around, I'm reading battery level from a BLE characteristic, it works fine with `async(UI)`+`await`, returns ~86%. If I switch to using
withContext(UI)
, the read returns 0x64 (100) and then the application crashes with
E/BluetoothManagerService: btsvc manager.putLogs                                                          java.lang.ArrayIndexOutOfBoundsException: src.length=494 srcPos=0 dst.length=743 dstPos=0 length=508
maybe that was a red herring, might just be an inconsistent BLE crash.... i'm really hating BLE on android
l

louiscad

02/01/2018, 9:25 PM
Weird. You're getting the issue using BleGattCoroutines? Feel free to reach through DM to provide more details, I can probably help
4 Views