Android App Inventor

I had an idea to develop for Android since bought this shiny, speedy, cooly Acer Liquid E. Anyone would like to! It's so smart, powerful and always stays with you literary everywhere! It is a great temptation not try to handle this power yourself.

I installed all requirements for development, but since then didn't have much urge to try do something with it because Android SDK would take time to get into. I am more focuse at Python and Django stuff at the moment. Meanwhile, I remember there's a thing called Android App Inventor - a tool for creating android apps visually, without actual coding. That's an easy way to try something on Android.

App Inventor consists of two parts: interface builder and block editor, that is used for adding logic to elements you've added with interface builder.

There's nothing special about Interface builder, actually. You have a pallete with standard visual elements like buttons, textfields, lists etc and some of non-visual components, like camera, image picker and, mind blowing component as for me - speach recognition. Just imagine, you have an instrument to turn words you speak into text without writing single line of code!!! So I thought that I have to do something with it, no matter will I use it or not. (Last time, when I saw another cool API - face recognition, I made Spycify :) )

I decided to make some kind of a dictaphone app with speech recognition. It has to:

Interface should be simple: text field and 3 buttons (start recognizing, send to evernote, clear). Elements positioning options are quite poor, so I couldn't place buttons exactly as I wanted. Text field didn't want to take whole space above buttons, so I hardcoded it's size. Now it looks OK in portrait orientation, but quite crappy in landscape :( Minus to App Inventor.

Let's move to making the real magic happen. Here's the "source code" of my app. Everything is quite simple. These blocks are quite similar to puzzles. You have event's (e.g. button click), you can place actions inside them: set a variable, call something, run activity etc.

As you can see, all you have to do to get your greatest speech recognised - call SpeechRecognition.GetText somewhere and place SpeechRecognition.AfterGettingText handler (square 1). That's it! You have a text that was recognized by those powerfool Google servers in a variable. You can assign it to a textfield, parse it, look for command words, everything you can imagine!

In our case we're checking if textfield (called Note) is empty then just add recognized text. If there's already something in it, add a newline before adding recognized text.

Another question is how to send your text to Evernote. There's one thing in Android called Activity. All the apps are built of them, and you can send special request (called Intent) to any app's Activity from your app, passing some variables to them. Evernote published parameters, that can be passed to their app's (very kind move, thanks Evernote!).

To start Activity (and send your Intent) you have special component ActivityStarter (who could have guessed...). Parameters to Evernote are passed in a special way with dictionary - you have to specify ExtraKey, and it's ExtraValue. For example, to preset a title of a new note, you should set:

ExtraKey=EXTRA_TITLE;
ExtraValue='title you want'

Body of a note is set with ExtraKey=EXTRA_TEXT. If you're makeing standard app with Android SDK you can set any number of those parameters. But ActivityStarter can send only one pair of these ExtraThings. If I'm wrong, please-please, correct me in comments! So my app send only note's body, and it's name I type manually.

That's it. The last handler (square 3) is clearing text field. As simple as it could be.

You can try your app in emulator, or right on your device. Everything you need to know about installing, using and deploying can be found in docs.

Yes, sure, you can't do Angry Birds with App Inventor. Nobody would try to, I think :) Moreover, App Inventor apps can't be published at Android Market (Google says they will allow it some day). There are geeks, who are building a Twitter app with it and even that's kind of crazy, I'd say. But if you are creative enough you can do something like marriage proposal app for the love of your life ;)