`Day47` - Reading time - RxAndroidBLE - Coding tim...
# 100daysofkotlin-2021
j
Day47
• Reading time - RxAndroidBLE • Coding time - Lock (Sammi lock) controlling app demo
BLEManager.kt
- create rxble client , device discovery using scan filter with key
Self-Comment
• First challengd - location permission thing. ◦ I definitely added the location permission in manifest, but it just didn’t work . Some error about location permission was being printed on logs. I just had to copy the location permission requesting method from Map demo app, and called that from onCreate, and it worked. • Second challengd - was with Rx….. and I just had to follow the company code snippet to fix my wrong code. ◦ I posted both working & not working code on this thread. And.. I’ll have to figure why not-working-code did not work. • Ugh…….I did not 100% understand the operation related with BLE. I’ll have to check the flow more thoroughly tomorrow. • Third challengd - is something with toast. As in the video I posted on this thread’s comment, I made the button text change, according to the Behavior Subject’s value. However I just can’t pop up the toast..? Hmmm
Goals-Tomorrow
• review controller flow - analyze it in notion. • resolve issues with toast • move on to Lock(PlusLock) controlling app demo.
하하
🎉 1
(memo)
NOT-WORKING-CODE
Copy code
connection!!.setupNotification(this.BICYCLE_CHARACTERISTIC)
                            .take(1)
                            .singleOrError()
                            .flatMap {observable ->
                                observable.take(1)
                                        .singleOrError()
                                        .zipWith(
                                                connection!!.writeCharacteristic(
                                                        BICYCLE_CHARACTERISTIC,
                                                        BICYCLE_COMMAND_PASSWORD
                                                )
                                        )
                            }
WORKING-CODE
Copy code
connection!!.setupNotification(this.BICYCLE_CHARACTERISTIC)
                        .flatMap { it }
                        .take(1)
                        .singleOrError()
                        .zipWith(
                            connection!!.writeCharacteristic(
                                    BICYCLE_CHARACTERISTIC,
                                    BICYCLE_COMMAND_PASSWORD
                            )
                        )
why..?