August 20, 2012

Learning how to tweak my Android devices to fit me

August 20, 2012 - Categories: android

One of the reasons why I like working with the Android operating system is that you can build little tools that interact with the other apps on your system. It’s like the reason why I like Emacs, although Emacs lets you go ahead and redefine routines. Anyway. =)

So here was my motivation: When you share a recipe from the BigOven recipe app, it sends the URL instead of the text. This is inconvenient, so I wanted to make a small tool that extracted the URL and opened it in the browser. That way, I could pass it to Evernote and save the recipe for later searching.

Android stitches different applications together through the idea of an Intent. An application can send an intent to another application in order to get it to do something. It can broadcast an intent to notify other applications that have registered to receive that event. An app can also register to receive various events.

To add something to the Share menu, I needed to write a small application that receives and processes the SEND intent. After trying to figure out if I should use a BroadcastReceiver or a Service or whatever, I settled on using an Activity instead. I might extend this to let me select one of multiple URLs, or recognize phone numbers and things like that too. We’ll see.

Anyway, source. =)

Small steps forward!