Writing interactive photo editors for Android

We recently released Musubi as a social messaging and app platform for Android devices. Musubi lets friends communicate using text, photos and voice, as well as using apps to create sketches or play games with each other.

With Musubi, we want to create a fun place for users to create and share content, and also a compelling platform for developers to create social apps. Here we will discuss how an app developer can make a photo editor that works with Musubi.

Editing pictures in Musubi is as easy as long-pressing the picture and choosing “Edit”. Musubi then finds apps on the user’s phone that are capable of editing photos and lets the user pick one from a list. Android’s system of Intents is perfectly suited for this, and it is a very common style of integration across Android apps. Android defines several well-known intent actions, such as “SEND” or “VIEW”.

Android also defines a standard action called “EDIT” for editing data. Simply filter on the EDIT action, and also specify the mime type of the data your app can edit. For example, to edit PNG images, filter on “image/png”. To edit any photo, use “image/*”.

However, the Edit intent as specified by Android doesn’t quite get us what we need. In Musubi, we wanted users to be able to choose a photo to edit, pick an application to use, and have that application return the altered photo so it can be displayed in a chat. According to the Android documentation, An app handling the Edit intent does not return any data to the calling app. For image editing, the location of the resulting image is unspecified and not reported to the calling application

The IN_PLACE category

Fortunately, Android intents offer a simple solution by way of categories. A category lets an app specify additional configuration information to a calling app, such as whether the target activity should be listed on the home screen (category LAUNCHER) or if it is safe for access from a browser (category BROWSABLE).

Musubi makes use of a new category for editing photos: mobisocial.intent.category.IN_PLACE. If an app includes this category in an intent filter, it is expected to save the resulting image over the image that was passed in as an argument, allowing the calling application to use the edited image.
Our whiteboard application allows a user to mark up a photo, with the resulting data returned to the calling app. Its intent filter is as follows:


<intent-filter>
  <action android:name="android.intent.action.EDIT" />
  <category android:name="mobisocial.intent.category.IN_PLACE" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:mimeType="image/*" />
</intent-filter>

The data passed in to the editor should be a uri for a file on the filesystem that can be read/written by both caller and callee apps. Also note that an intent filter with this IN_PLACE category will still match on intents that don’t specifically request this feature.

This simple addition to any photo editing app will make it more engaging and social, and we hope to see many apps take advantage of it soon!

Mar13

8 Responses to “Writing interactive photo editors for Android”

  1. Magne Roald Says:
    April 2, 2012 at 1:31 am

    Hi,
    Do you know of any image editors on android that supports this?

    Magne

  2. Thanks for tips!
    I have tried and cool….

  3. This looks really impressive. I’m ditching my iPhone 4 soon for a Galaxy SIII, so I’ll have to give this a shot!

  4. I will try this on my HTC thanks!

  5. [...] Via MobiSocial – Stanford [...]

  6. In recent years, it’s been the singer’s personal troubles making headlines

Leave a Reply