New Cordova Plugin for Android Intents

I had a bit of a problem; a year ago I wrote a blog detailing how to write a Cordova based application (Cordova, PhoneGap, Ionic or any other cordova-based framework) on Zebra devices.  The strategy was to use 3rd party Cordova plugins to provide an interface to Android intents.  The detail is not important for this blog but the critical part here is that customers were being advised to depend on 3rd party plugins, provided under MIT license with no assurances on the future of those software components.

Fast forward a year and I went to update my previous blog to account for the new enhancements to the Intent interface on Zebra device.  I found that the two 3rd party plugins being advocated were both no longer suitable for purpose for different reasons:

The first of these plugins is marked as no longer maintained.  The second of these plugins is no longer available on GitHub, the link above points to my fork.

There was also some additional functionality that was not provided by either intent, I would like the ability to register a broadcast receiver and also an implementation of startActivityForResult since some upcoming Zebra utilities may be offering this as an interface into their hardware.

So, I gave up with 3rd party plugins and decided to make my own over a bank holiday weekend.

The Plugin

com.darryncampbell.cordova.plugin.intent is available on GitHub and NPM.  Right now, very deliberately the plugin is only at version 0.0.1 until I have some more feedback and have used the plugin myself in some real projects.

There is a demo application which shows the use of the project on GitHub.

I have released the plugin under MIT and re-used portions of the code from the linked 3rd party plugins above (with full accreditation, note that those other plugins were also released under MIT).  I have added functionality to register / unregister broadcast receivers as well as an interface to startActivityForResult.

Next Steps

As I use this plugin in a real project you may well see some version increments over the coming weeks.  Any feedback, please write below or post in the GitHub issues for the relevant project, as I say, at the time of writing the plugin is still at version 0.0.1.

For reference, the original blog to use intents to control Zebra hardware is here: https://developer.zebra.com/community/android/android-forums/android-blogs/blog/2016/08/04/integrating-datawedge-into-your-cordova-application and has now been updated to incorporate the new plugin.

Leave a Reply

Your email address will not be published. Required fields are marked *