Categories

Day 24: unblocked, at last!

During the week-end, I established BLE communication between a nRF51822 chip flashed by Matthieu and my smartphone (with Scaloid), but I was constrained by the UI: the only display I was able to do was toasts.

So, at the beginning of the week, I decided to explore Android’s View and Adapter. It began well… and then I was stuck for two days on a LayoutParams cast error! After having read lots of source files of Android API and Scaloid, I finally understood what was happening: an AbsListView checks the LayoutParams type of its children, but only when ids are stable (and for an ArrayAdapter, they aren’t). This behaviour is quite strange, I am not sure if it was on purpose, it may be a bug in the API.

I was quite angry at Android for a moment, but I was relieved to have solved my bug, as well.

Then when Sam informed me that my app was flooding his phone, replicating the same device hundreds of times, I was confused, because it only appeared once on mine. I did experiments with all the phones available in the room (Nexus 4/5, Android 4.3/4.4/4.4.2, with or without CyanogenMod), and discovered that I had bought the wrong phone: for hardware reasons, the Nexus 4 receives 100 times less BLE advertising packets than the Nexus 5. Sad, isn’t it?

I lost a lot of time with these two issues, but now I can finally go on with my app development and start implementing services for drop messages. And even if I was a little angry, it was really interesting to solve my problems, since it allowed me to discover a lot more on Android.

Commentaires fermés.