Today’s post on the Android Developers Blog annoys me. Titled Integrating Application with Intents, it describes pretty awesome mechanism by which one app can re-use parts of another app’s code, provided both are structured properly.

If you’re technically inclined, head over to that blog for the nitty-gritty of things. It’s pretty well done — and obviously not the part that annoys me.

What bothers me is that despite having come up with such a great mechanism for code re-use, Google have missed two vital bits to make the whole thing useful:

  1. There are no standards for Intents.
  2. You cannot model dependencies on Intents.

Let’s take PackRat as an example: it re-uses code from the fantastic Zebra Crossing project in order to let you scan barcodes of your favorite media items. Yet it reuses them in a primitive fashion without using Google’s Intent mechanism. Rather, code is duplicated between the two projects.

The reason for that is simply user comfort — that is, yours. While it’s entirely possible to rearrange PackRat’s code to use the Barcode Scanner app from the ZXing project for scanning instead — via Intents — the simple fact is that you’d need to install both in order for PackRat to unfold it’s full potential.

Unfortunately I cannot mark PackRat to be dependent on the Barcode Scanner app in such a way that you’d automatically install one if you also install the other.

Which is fine, if you’re an Android geek. It’s not fine if you’re my mum. While she wouldn’t necessarily find any use for PackRat, the sentiment that she should be able to use it if she wanted to remains valid. Why place a higher burden on users than strictly necessary?

Modeling dependencies between software packages is essential if you want code re-use and user comfort. Google seems to have missed out on that opportunity so far.

In PackRat’s feedback forum, someone fairly empathically argued that I reuse Barcode Scanner anyway — and I even agree with the principle of it. One of the things they argued for, though, was that by decoupling PackRat from the actual scanner app used, people could pick their favourite app for that task.

Unfortunately, that’s just not true. Any Intent for scanning I might use would certainly be understood by ZXing’s Barcode Scanner, but not by any other. That’s because ZXing came up with the Intent and parameters to use by themselves. While they may have documented their approach fairly well, there is no guarantee that any other developer would provide a compatible app.

Standards are never guarantees for that, granted. But at least they provide some form of pressure for developers to either conform or publicly document a competing, potentially better standard. Right now, in the Android developer community, there is neither.

Android needs standards for Intents, and similar means for apps to interact. makes a passable attempt at documenting what apps do and expect out there, but that’s not the same as Google endorsing them as standards — not by a far cry.

So Google’s blog entry annoys me. On the one hand, they’d like to encourage us to re-use code, and have even provided a clever approach to facilitate that. On the other hand, their support falls woefully short of enabling developers to provide true integration.

In the end, the decision to duplicate code rather than re-use it more elegantly was clear: user experience comes first. And for the time being, that’s better achieved by more primitive means.

5 Responses to “(Not) Integrating Application with Intents”

  1. Justin Says:

    Your point that a better Intent discovery mechanism is needed is well taken, and its something I have literally lost sleep over. If a better Intent discovery mechanism were available then the developer community would gradually evolve standard Intents, and perhaps ZXing’s Intent structure would be used by all barcode scanning apps.

    I’m glad you’re not satisfied, neither am I. If you’re unhappy though, I encourage you to do something about it (kudos for taking the time to write your post). Android is an open platform and there’s certainly the potential for the community to address this issue. is endeavoring to do so and I applaud them for their work. I’m not abdicating or passing the buck, I’ll work to promote a good solution for the platform for Intent discovery, whether it is something new Google undertakes or bolstering something that already exists.

  2. unwesen Says:

    I think pointing new developers to or a similar collection of de-facto standards (they would work well enough as standards IMO) would be a great first step. I’m not so much interested in processes for creating standards as I am in the results. Unfortunately, pointing new developers anywhere pretty much lies in the hands of Google.

    The second thing that’s needed IMO is marking AndroidManifest.xml with e.g. a “uses-intent” tag. Android Market could theoretically then offer a selection of apps that react to the intent for download, if none is installed. Again, though, that’s not a change I can initiate — other than by writing about it in places like this.

  3. Mark Says:

    Yep – pretty much what I was thinking too when I read that post this morning. Excellently written article but the end result lacks standards.

    Then, later in the day, I need to write a file browser for an app I’m writing. So I googled and all I could find were suggestions to use something written by OpenIntents. But like @unwesen says, it gets messy for the 95% who don’t already have an appropriate app installed.

    The “uses-intent” tag makes perfect sense. Combine that with standards and its all win.

  4. esper Says:

    @Justin, your suggestion that “Android is an open platform” is a complete laugh. Android is very much proprietary. Even the name is trademarked. There exists an AOSP code dump. But since nobody uses AOSP, I can assume that this blog post is about Android, which is obviously not an open platform.

  5. unwesen Says:

    By a slightly roundabout route, we’ve now come to the point where bits and pieces are discussed again in the OpenIntents group:

    Please do participate!

    @Mark: I’d love to see a “uses-intent”-like tag.

    @esper: My hunch is that Google would be a lot happier opening Android up more than they can right now. But they’ll have to act as a buffer between us developers and carriers, who generally favour total control over anything else. Let’s be civil to people involved in that.