Best way to send messages from Cordova to a native iOS app?


For my hybrid Cordova app, I need a way to send messages from the Meteor web app over to the native iOS side. I looked around, but could not find existing code for this. The only solution I see so far, is to implement a custom Cordova package, and deal with the message handling myself. Did anybody find another solution?

If a custom plugin should be the only viable option, I am wondering how to add this custom Cordova plugin to my app. According to Meteor docs, there are only two ways available:

a) download it from the Cordova plugin-registry (which would mean I had to publish my package there)
b) put it on Github and load it as a tarball

Option a) does not really make sense for me, since I don’t want to pollute the plugin registry with my private code. Option b) is also not really optimal, since the tarball has to point to a specific version (at least, I think it does).

Is there also a way to include a custom Cordova plugin using the cordova-build-override folder? If so, how do I maintain the dependencies from a Meteor package to this Cordova plugin?

Building hybrid apps; is it even possible?

I’m not sure what your hybrid app architecture looks like, but if you’re using the standard Cordova web view, a custom plugin seems easiest and would allow you to use the built-in message handling mechanisms.

Meteor 1.2 allows you to add a local plugin using a file:// URL, which is more convenient during development and means you wouldn’t have to publish it.

Out of curiosity, what is it you’re trying to accomplish on the iOS side?


Hi Martijn,

thanks for your quick reply. I already started developing the Cordova plugin. It takes a lot of time, though, because I have to update the git repo on every file change, copy the commit UUID from GitHub, paste it into my Cordova.depends() call and re-build the complete Meteor project from scratch… So the change you mentioned for Meteor 1.2 is very, very welcome!

Regarding my project: I explained it a bit in this thread

I need the Cordova plugin to send messages to my native side, since I found no other way to do this. Only the direction native => web app is available out-of-the-box, using the handleOpenURL() method.