Hyston blog
About • RSS

CoreBluetooth

2018-03-13 23:19

In last post I wrote about bluetooth tracker app, that I have tried to create. The idea was to develop battery widget for iOS today’s screen, similar to standard one, just with one difference: it should show not only currently connected devices, but also keep track of previously synchronised.
I use AirPods every day, it’s very handy to always have a headphones in your pocket without need to unravel wires. They can play 3-4 hours by themselves, and charged then by case several times. The problem is that phone shows the battery level of case only when you open it and keep at least one ear piece inside, which in regular usage happened never. There is a LED inside, but with my poor eyesight I constantly got mixed up green with red on such small dot. Goal was to show last known battery status to all connected and previously connected devices, especially AirPods and their case. Work with Bluetooth in iOS is relatively simple and in detail described here. The Bluetooth framework called CoreBluetooth and to get battery level of surrounding devices you need to implement these steps:

Unfortunately, as I said, AirPods does not provide ability to connect them directly. May be I’m just missing some obvious point, but I have spend several hours trying to connect them, when in the end I decided to search in AppStore applications, that will find bluetooth devices nearby. None of them were able to provide more information, that I have found during debugging. I still think, that it should be possible somehow - AirPods can be connected to Android, after all, but after several wasted evenings I gave up. I have some more interesting ideas in mind.


Next entry → ← Prev entry