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:
<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/*" />
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!