Cordova benefits vs custom native wrapper

I’d like to understand more the pros and cons of using the MDG cordova wrapper vs. just building a basic android webview wrapper app. It’s not very clear what MDG ( @slava ) built on top of cordova.

With the MDG cordova build:

pros

  • login/cookies seem to work well
  • can use other cordova plugins
  • when it works, its simple

cons

  • images are “cached” but all the assets download every time there’s a code update (bad)
  • doesn’t properly support android crosswalk chrome webview atm
  • can’t use new ios WKWebView yet link
  • fragile process with many layers. when it doesn’t work, good luck

With a native wrapper app

I need to use chrome webview, had trouble with crosswalk build, so I built my own simple android wrapper. This ended up being much quicker than all the time wasted messing with cordova build, and feels much more solid.

pros:

  • can use a chrome webview with no problems or waiting for cordova to support it
  • build process is fast and rock solid, all the native tools are available
  • can add my own extensions easily - all native SDKs are available, tho it takes some bridge/wrapper work
  • if you’re just opening to a hosted meteor site, you get all the “code update” stuff too

cons:

  • Tweaking to support cookies was a bit more time and still not perfect. I’m having an issue where when the app auto-updates, all cookies seem to get cleared
  • can’t use cordova plugins? but you can use any native SDK or API with a little work
  • little more work to setup

So overall, doing your own native wrappers really isn’t that much work, and gives a lot more build stability and flexibility.
You could do things like implement your own image caching code to prevent downloading assets every time there’s a code push.

I’m wondering if I’m missing something related to the local webserver benefits. Is this somehow running the JS server side code locally on the device, but using a remote mongoDB connection? Or is there some other magic benefits to the MDG cordova wrapper?
Are there other problems expected of just a plain webview that running the local webserver helps?

I guess this will be a moot point soon when reactnative supports android. Why would you use phonegap when you can use RN to get a hybrid app with native navigation and occasionally a meteor webview.

If anyone’s interested I’d be happy to share the lean mean android wrapper.

was related to this SO thread

1 Like

For the record, we don’t actually run a web server, we just rewrite URLs for you. The main reason for this is to make sure that pushState routing works. In the default Cordova wrapper, you can’t use Iron Router, for example.

images are “cached” but all the assets download every time there’s a code update (bad)

This isn’t great, maybe we should have implemented some sort of diffing. But the goal is that you can just use assets from /public and they will work instantly, even offline.

If you have had success with a custom wrapper, that’s very exciting - consider sharing your work so that other people can benefit as well!

image caching

I ended up putting all the assets into a CDN. I guess some kind of manifest file approach maybe best in the end, like ReactNative and others have.

sure. i posted the wrapper here as a repo, it’s really pretty basic but seemed to solve some of the headaches I was having with phonegap.