Android Intents: Developer Best Practices, Page 2
Develop Your Own Android Intents
Android app developers can, in theory, promote their applications more easily at the OS level by implementing and exposing their own intents for other Android apps to use. The user will still need to install your Android app first, but they're more likely to use it if it's well-integrated into their OS. Clever, eh?
The simplest way to do this is to provide functionality associated with that first group of intent types, again like
ACTION_SEND, with the content types in which your specific application excels. These are the types of intent requests most frequently used on the system, for features like "Share." By using these stock intent types, your application will automatically become one of the applications that is listed in any picker when more than one application is capable of handling an intent request. The originating application doesn't even need to know of your existence to integrate with you.
Less common but still sometimes effective is the idea of making custom intent types for other applications to use. Here the task of documenting and supporting your intent types is more burdensome. You need other applications to request your intents explicitly and somehow ensure that the user installs your application in the first place. This technique often works for very popular applications that provide some sort of popular service. For example, a popular auctioneer or bank might create an application with a set of well-understood intents for use--it helps if they already have APIs and third-party developer relationships to draw from. This technique also works well if you develop a suite of applications and want them to be well-integrated with one another.
Regardless of which avenue you take, it's your responsibility to provide adequate documentation of the intents your application uses and the extra data it supports.
Android intents are the foundation of the powerful application integration system that helps set Android apart from competing platforms. Your applications can integrate with other applications by using those intents that are properly exposed and documented, and expose your own application functionality to other applications by handling intents of specific actions and types within your own applications.
About the Authors
|Shane Conder and Lauren Darcey -- Contributing Editors, Mobile Development -- have coauthored two books on Android development: an in-depth programming book entitled Android Wireless Application Development (ISBN-13: 978-0-321-62709-4) and Sams Teach Yourself Android Application Development in 24 Hours (ISBN-13: 978-0-321-67335-0). When not writing, they spend their time developing mobile software at their company and providing consulting services.|