Thursday 6th December, 2012
8:30am to 9:45am
Android developers often lament the ability for Android to natively discover and launch application extensions via plugins. The native Java ServiceLoader class is now included in the Android SDK, but it isn’t nearly as effective as it is under Java Standard Edition. Java class-loader solutions often introduce more problems than they solve, and in practice Android’s class-loader separation ensures that object instances created in one Activity or Service aren’t visible inside of another Activity or Service. All is not lost, however.
Android provides all the requisite pieces for truly powerful plugin architectures: Intents, Services and Content Providers. The Content Provider fulfills the role of the plugin registrar. Services, even when deployed in separate applications, represent the plugins available for discovery. Finally, the Intents provide the inter-process communication mechanism that lets all of these disparate pieces work together.
You will leave the class with an understanding and sample code that demonstrates how to create a simple Content Provider implementation that serves as a plugin registrar. Techniques for declaratively classifying different types of plugins (services) and dynamically registering new plugins will also be covered in-depth. Application and service metadata discovery using the Android PackageManager class will also be covered. The class will wrap up with a mini-primer on the Android IBinder interface specifically in the context of cross-process method invocations.
You are encouraged to have a primitive understanding of how Android Intents are used. No prior experience with either Services or Content Providers is assumed.
Sign in to add slides, notes or videos to this session