Intents in Android

If you’re an iOS developer who’s never had a chance to work with Android, there are a few things that you should have a look at.  My favourite part of Android is the Intent system.  It’s an easy and flexible way for apps to add features.

In iOS, when you want to allow the user to send an email from within your application, you instantiate an MFMailComposeViewController and present it.  But what if you’re a Gmail user?  We’re stuck sending you through the default mail sheet.

On Android you instead send an mail intent.  This is a way to say to the system “I want to send an email”.  The system picks your default mail app and presents a send screen.  It’s far more flexible and respectful of user choice.

Mail is just an example.  You can send an intent to do just about anything, and define custom intents of your own.

Extensions in iOS 8 look like they’re bringing a level of this flexibility to iOS.  I’m eager to see if the implementation results in the same explosion of choices available on Android.