Latest Tweets

 

An Intent to Pick Daisies

One of my favourite things about the Android platform is how easily application can share data using Intents and ContentProviders. They provide a universal basis for Android applications to interoperate and I try to expose them whenever it’s practical, even for something as singular as my Daisy Garden application.

I’ve just published a new version of Daisy Garden and with it, Intents and ContentProviders that enable the users of other Android applications to choose flowers they have grown in Daisy Garden — assuming that the developers choose to support it. And the great thing is that supporting third-party intents is very easy to do (and even if no other developers use them, they will be heavily used to integrate my own applications).


An example of what the user sees when picking a flower.

The Java code embedded below is a self-contained Activity that responds to a tap on the screen by inviting the user to pick a flower and then displaying the flower as a bitmap. There are two basic parts: forming an Intent for the user to pick a flower and forming a Uri to the flower’s bitmap. Both of these aspects can be customized; messaging to the user, and the bitmap size for example.

It’s very simple — more than half the code is boilerplate and comments. And this is what’s really good: in a well structured Android application this functionality is simple to expose too — I’d go as far as saying it’s almost automatic, so there is very little reason not to share (non-sensitive) data between applications.

Having said all this, there is an interesting technical detail here that meant that I had to give some thought to exposing the bitmaps. Daisy Garden is generating the flower bitmaps “on-the-fly” when they are requested from the ContentProvider and it’s not obvious how to share these unless you know a little about how Linux filesystems work. I’ll try to find some time to outline the technique in a subsequent post.

Java code follows:

Daisy Chase gameplay

Daisy Chase gameplay

Moseycode registration

Moseycode registration

Scanning a Moseycode to get new levels

Scanning a Moseycode to get new levels

It’s been an extremely busy few weeks and I’m now looking forward to having a little more time to focus on Android development again. One thing I did achieve this week was to put live a very early version of a game I’ve been developing called Daisy Chase. It’s a “simple” game in which you have to capture flowers by linking them together. I say “simple” instead of just simple because I’m again humbled by how I can misjudge what users will really can understand simply. Nevertheless, I’m quite pleased, the game appears to work (no bug reports yet) and some users report really enjoying it. I would have liked to have entered it into the ADC2, but I had no time (and the competition in the game categories looks especially strong).

I’m really excited about two elements of this new Android application. The first is that it will be the first application that makes use of the Moseycode publishing API to allow users to publish, own and share their own levels. One of the screenshots above gives a preview of the user registration page (not yet incorporated into the application).

The second thing is that, as a big fan of the Intent system used in Android, I’m looking forward to the integration that game will have with Daisy Garden. For example, By achieving particular goals on a level, you will win one of the flowers that appears in the level and this will be added to your garden. In the full version of the game, levels will be collected into gardens and completing all of the levels in a garden will add that garden to the collection of gardens you can grow flowers in.

It’s all part a minor (but time consuming!) experiment in how games, and not just regular applications, can be broken down into separate units that have individual value. It’s a remarkably involved task to do effectively.

The alpha version of Daisy Chase is available from the Android Market.

With a number of Android applications laying incomplete in my digital atelier, I felt a pang when Dan Morrill announced that the Android Developer Challenge 2 was open for submissions on Twitter. I’d had no intention of entering the competition until I read that tweet and felt personally challenged. Rashly, I decided that I could get Moseycode integrated and the rest of the application adapted for ADC2 in a handful of long evenings.

It’s too early to say whether I’m going to make it yet, but I’m glad I’m shooting for it. This is one of the products of my rapid labour: the ability to publish flowers from your garden as pictures that you can share. Anyone else with the application can import the flower directly from the in-built Gallery application or by scanning the picture with their phone camera.

I really like the idea of this sort of sharing - where the artefact is both appreciable by people and machine readable. I don’t know how it’s going to pan out yet, but you can expect more of this approach from my next applications (and not necessarily via moseycodes either).

With a number of Android applications laying incomplete in my digital atelier, I felt a pang when Dan Morrill announced that the Android Developer Challenge 2 was open for submissions on Twitter. I’d had no intention of entering the competition until I read that tweet and felt personally challenged. Rashly, I decided that I could get Moseycode integrated and the rest of the application adapted for ADC2 in a handful of long evenings.

It’s too early to say whether I’m going to make it yet, but I’m glad I’m shooting for it. This is one of the products of my rapid labour: the ability to publish flowers from your garden as pictures that you can share. Anyone else with the application can import the flower directly from the in-built Gallery application or by scanning the picture with their phone camera.

I really like the idea of this sort of sharing - where the artefact is both appreciable by people and machine readable. I don’t know how it’s going to pan out yet, but you can expect more of this approach from my next applications (and not necessarily via moseycodes either).

Daisy Garden, my latest Android application, in action. A poor quality video unfortunately - shot from my webcam. It doesn’t include sharing flowers yet, but it will.