Klara Live for Android TV

Do you recognize this feeling:

technology is there to help you, and in theory it can do lots of cool stuff to make your life more comfortable, yet it only seems to cause more frustation.

Yesterday I felt exactly in this spot 🙂 Let me paint some context.

A few years ago I moved into a new place and didn’t immediately find a spot for my radio. I bought this radio when I was 14 years old with just about all my savings. You have to imagine: a cool radio in that era had to be bulky and excessive wrt tweaking nobs and bass sounds etc. Problem with this is that it consumes quite some valuable living room space. Even more, in the last few years I didn’t often listen anymore to air-broadcasted radio. Nowadays it’s all about on-demand internet streaming, right? 😉 But I also listened less and less to radio channels in general. There is one exception though: I turned into a loyal Klara listener. (Tastes can change!) You can hardly call it a “classical” radio station though 😉 There’s no screaming at you or ads interrupting every 10 mins.. Very peaceful indeed. Anyway..

Without a physical radio in my living room, the ideal workflow to start listening is as follows:

  • Open radio app on my tablet
  • Cast to TV

However, the real-world workflow is more like this:

  • Turn on my android tablet. Wait up until 1 minute until it has “warmed up”. This has everything to do with Android becoming so bloated Google had to introduce the Doze feature which basically makes your device useless unless under active use (read that again 😉 ). This guy summarizes the Doze matter quite nicely.
  • Open my radio app (good app unless you use Android Pie)
  • Wait for the ad to materialize, otherwise playback stops. Same goes for syncing of mail accounts which kicks off due to awesome Doze feature.
  • Open the desired radio channel and press play button
  • Wait for the stream to start playing.
  • Google cast the stream to my Android TV (Nexus Player connected to “regular” smart tv)
  • Wait for my tv to automatically turn on using HDMI CEC.
  • Check whether the android TV responds to the cast call. Several possibilities here:
    • the TV fails to turn on -> turn on manually
    • the TV turned on but forgot why (cast does not start)
  • Realize it is broken again, and cast again from the tablet.
  • You see it’s working now and starting doing other stuff, only to realize a few minutes that the stream stopped! This can be anything: from the tablet sync somehow interfering in the playback on the TV to internet connection problems to the TV restarting services (but not resuming) because it deems it needs more memory.

Although my television has sub par sound quality, it highly exceeds the fidelity of my tablet or phone. 😉 It does however consume quite some power: ~120W (off the top of my head). Luckily I can fix this with a few extra button presses. So the final steps in the workflow are:

  • use TV remote to open menu (where you can configure brightness etc)
  • go into first menu “Picture”
  • navigate to bottom of list (luckily you can go up to end up at the bottom)
  • select “Picture off” and press OK

Only consumes about 20W then, which seems acceptable to me.

Conclusion: while listening to the radio should be only a few clicks/touches away, it literally takes minutes to set up.

Mind you, this is only turning on, not turning off! You might think: is that even a thing? You just “turn it off”? That would be to easy in today’s technologically advanced world!

Option 1: turn off the TV. Simple right? Problem is that does not stop the audio stream. Since I still live in a country where bandwidth is not unlimited, this is not an option.

Option 2: use android tv remote to exit cast (press home button a few times), then turn off TV. Problem is: sometimes the tablet will think the TV temporarily went missing and will start the cast again. (without you knowing, because you turned off the TV 😉 )

Option 3: the solution is to disconnect the cast on the tablet (sometimes it lost connection to the TV by itself) and then proceed with option 2. To be fair: successfully disconnecting the cast should stop the cast on the receiver (TV) too, so it saves time in option 2. However, disconnecting is cumbersome, it is not the same as simply pressing the stop icon in the notification (which merely pauses the cast on the receiving device)!

Anyway, this is a (quite elaborate) rant on why casting sucks. I feel sorry for ranting so much but after all, it is the tag line of this blog! 😛 So now, let’s cut to the chase!

Yesterday morning (when you don’t have much time), I was exactly in that spot again and decided to do something about it. First I checked my app updates (android TV updates when it feels like updating). Lo and behold: there was a google cast update! For a minute there, I had hope. I installed the update and checked: nah, although the changelog told me “bugs were fixed”, of course, not this bug. 😉

Reducing the number of dependencies seems the obvious solution: the less components are involved, the less can go wrong! In this case a native Android TV radio app could ease the pain but neither general radio apps nor specific Klara apps are available. In a peak moment of frustration I thought to myself: I will create an app this evening myself! Of course I’ve had this thought before, but anyone who has created an app knows that the effort can highly exceed the enjoyment, especially when you decide to share your app with the rest of the world because you feel any good compassionate person would do that.

But this app seemed so simple I thought: it can’t go wrong. 😉 In any case, I’ll keep it to myself until I feel it can more or less defend itself against the judgemental tsunami the internet can be.

Though, without further ado, here is a small demo.

It’s so basic I almost feel embarressed about it. 😉

The plan is to make a fast minimalistic app:

  • Only live stream (+ continuo maybe later)
  • Only foreground. You can stop playback by exiting the app.
  • Temporary pause (for a few seconds): answer a phone call and resume the radio where you left off
  • Maybe: show current song metadata

K.I.S.S ftw!

OnscreenClock v0.5.0k and ADBoverEthernet v0.8.6

a few weeks ago, ADBoverEthernet was removed from the Google Play store due to a payments policy violation. As you may know, only Google is allowed to make profit off your app, so you may not provide alternative ways of payment within the app. Since my app only provides Google’s In-App payment and still got removed, apparently it’s also not allowed to even mention other possibilities. I removed the mention of my paypal and link to my donation page on this blog. So everything should be good now. 🙂 I also updated the OnScreenClock app as it shares the donation code with ADBoverEthernet.

It took me a few iterations to get the new apps released as Google forces you to upgrade the target sdk to at least 26 (= Oreo) these days. With this upgrade comes extra limitations on background processes. ADBoverEthernet used a service to launch shell commands. I changed that to use the new WorkManager api.


ADB over ethernet v0.8.6 2019-04-24

  • show app version
  • make output window scrollable (in case of exceptions)
  • fix NPE crash when back button is pressed before webview is fully loaded
  • fix crash opening website on TV device that does not advertise itself as TV
  • store compliance
  • fix NPE’s when user revokes overlay permission while configuring the clock

OnScreenClock v0.5.0k 2019-04-18

  • trying to fix overlay permission trouble
  • bumped min sdk version from 15 -> 16
  • bumped target sdk version from 23 -> 26
  • fix crash on Android Oreo and higher when launching clock service at boot time
  • fix NPE’s when user revokes overlay permission while configuring the clock
  • fix admob crash