breaktime android


Play Store Main Website

This is one of our experimental apps for capturing radio broadcasts in the UK and it does it in two ways. You can get the app from the Play Store (see the button on the left) and the project file (App Inventor 2) from the Dropbox site (another button on the left).


What's the rationale here? I'll tell you. Pull up a chair and a cuppa (pour me one whllst you're at it, will you please?) and let's begin.


Once upon a time there were only two ways the general public could receive radio broadcasts. There was AM (amplitude modulation) which was never very clear but did it's job, and FM which was super clear but needed acres of spectrum space. AM could be broadcast over very long distances, FM over shorter ones.Then came digital radio. When they first advertised digital radio you'd have thought, from the hoo-ha, that the waters of the mississipi would flow backwards, statues would weep blood, everybody would become immortal and that Jesus himself was returning imminently but was just having a cigarette before he started. Those of us who knew a bit went  "hmmmmmm..........."

So, digital radio has been around for a few years now and it is possible to make an in depth analysis of it and here it is:






Sets are ridiculously expensive, coverage is patchy, it's no good boosting because a signal is either full on or full off and if you live somewhere remote you've had it. Yes I mean you,  readers in Pant- y - Girdle in darkest Wales, and you lot sitting there in  Hay-up on t' Coalhole  in the frozen North (of Yorkshire) and you there in Scotland in somewhere spelt as "Kirkbrigalochacreekie" but pronounced as "teacup". None of you are getting digital radio very easily I'm afraid. Even down here where I am currently bashing out this article in the well known super-metropolis and Cultural Beacon that is Barnsley, digital is patchy.





We live in an age when most of us carry round a small mobile computer. Usually it's phone shaped but it could be a tablet. Lots of people carry both.

If it's a phone it's a 3:1 chance that the operating system that phone uses is Android. There are such things as i-Phones but we don't talk about those in polite society. There are such things as Windows phones but since they are for businessmen ("Honestly......I wanna see you be brave".......... and cut your excessive salary in half)  let's not even acknowledge their existence (the phones that is not the businessmen although that might be nice too). And we are now at the ridiculous situation where it's often easier to get internet access than a radio signal. Hmmmmm.


I've done a bit of ranting on tangents up there and so to pull the threads together:  radio + digital + internet + Android = solution.


Except that the BBC have done a media player for Android that is even more awful than digital radio. It's a bolt-on to I player to parse the streams. It's bulky, it's awkward and it's a pain sometimes on Android.

So let's use VLC instead and start it remotely from the same app that we start all the non-BBC channels from just by clicking a button. What a nice idea.


VLC for Android is in the Beta stage. Beta stage is when the programmers chuck it out and everybody else tries to break it. So, it might be a bit flaky for some things but for this game it does the job admirably plus it can parse lots more sound files than Play Music and so it is generally a better choice anyway.

It's awful.


Over on the left there you can see the interface I made on a Tesco Hudl. The top four activate chrome, which in turn activates Radio Player. The below is what happens if I press Classic FM:


And as you can see what it does is to bring up in Chrome the radio player. So all the hard work is done there and in AI2 all we need to do is the following:


Well, actually that isn't all we need to do because the purple bit at the bottom named "player" is in fact a procedure that is called every time a button is clicked.


If you don't know procedures are blocks of code that are used lots of times in the same programby different bits of that program. They're also known as subroutines. Every high level language has them and to get them to go there is a keyword: in this case it's call, but in other languages you may see GOSUB, and in C you set them up as functions and call them from the main loop , for example:





which is an Arduino example.  Let's have a look at what that procedure does:


Alrighty then it's down to the activity starter (AS).  To get the AS to do anything, first of all you have to give it something to do. In this case it's android.intent.action.VIEW  which in plain English means you want to use an in-built Android action which is VIEW.  VIEW simply means "go on the internet" . Once it's on the internet it needs something to look at (or in this case an audio file) and so the next block down tells it where we want to go. If you look back at the Classic FM blocks you'll see I gave the variable a URL to go to and that's what this procedure will read. The URL in question was  





http is hypertext transfer protocol which gives the AS a clue it's a webpage, so it starts up chrome and shows me the page. Nice. Actually the first time it gave me a choice of browsers, Puffin or Chrome, since I have Puffin installed too. So I just told it always to use Chrome and off it went. (Puffin is a tad slower than Chrome for this game but I have Puffin because it can do Flash whilst Chrome can't.)


If you try this method with the BBC streams it wants to send you to the media player and does not always work. Besides that it's clunky. So we want to start VLC when a BBC stream is required and let VLC play it. All of the code-blocks behind the buttons work in just the same way so let's have a look at the  one that does Radio 3:


radio3 blocks

I particularly want you to notice the front of that url highlighted in blue. It runs mms://wmlive- and this gives the game away nicely. MMS is Microsoft Media Server and wmlive is Windows Media which is the problem here because Android does not handle that natively and that's why we need either the BBC media player and I player or VLC.


I have no idea what acl stands for but it can be acl or non acl and so I assume it's something to do with the audio protocols but in any case it's handled by VLC and so we need not worry about it.


And there it is. A handy pocket radio that costs nothing to make if you already have an Android phone.

Feel free to download the project and tinker as you require.



Ian Lang, August 2014

Project Files Radio_Phone

The above button allows a direct download of the AI2 project file (.aia)