8

The goal is to use an existing web app and create an Android and iOS versions of it with some functionality added (Push Notifications and Location).

Being an Android/iOS developer, does it make sense to use Cordova with its native plugins for such kind of development or it would be wise to end up with 2 codebases (for Android and iOS) that would load the web app in a WebView? Need to mention that all the content must be loaded remotely (no html/css/js files can be stored in the app).

There would be some heavy security requirements on the application and I am afraid of 2 things:

  1. It might be more difficult to implement security using Cordova plugins that using a native app.
  2. It might be more difficult to make one single html/css/js app behave the same on both platforms.
  3. There is no need to use Cordova if I am a native developer and could make things faster with native apps.

If there is someone who could give some opinion or share experience on this, would be very helpful. Thanks in advance!

Robert K.
  • 1,043
  • 1
  • 8
  • 20
  • 1
    I use Bootstrap and created a custom Single Page App that runs on both Web and the native iOS perfectly. You just need to add in a flag for certain calls and to show certain native buttons. Other than that, I load all my css/js files remotely and it works great. And I am finishing the Android phone gap version this week... One codebase for all... – Paul Jan 18 '17 at 15:18

3 Answers3

4

At first, there is no harm in spending a little time trying out Cordova.

The Cordova command line tool is easy. The documentation discusses about differences between Android and iOS. I found it a good read. You can learn something if you are not expert in both Android and iOS.

There are a lot of cross-platform plugins for Cordova. If there happens to be a few plugins that you need, they can save time and effort. (Simply cordova plugin add it. Using plugin is simple.)

Cordova performs tweaking for you to make WebView easier to use. (But some people might consider the default Cordova setup unsuitable.)

It seems you will write some Java, C/C++, or Objective-C regardless of whether Cordova is used. There are 2 ways to use Cordova in your app: Write your native code as a Cordova plugin so you can call the plugin from Cordova; Or embed Cordova in your native app. Cordova forces you to organize your app in its ways, so you might consider it inconvenient.

(There is the Web Crypto API, which can be called with pure javascript, but you need to consider if your devices support it.)

If you want to squeeze out every bit of performance, you may want to write your app with WebView eventually without Cordova.

After using Cordova for some time, even if you decide to stop using it later, and rewrite the logic for your own cross-platform codebase, you may still learn useful things by reading Cordova's source code.

cshu
  • 5,654
  • 28
  • 44
2

Depends on complexity of web apps. Got some experience with angularJS heavy apps and I can tell that cordova is pretty slow. Massive SPA's have performance problems, mainly when it comes to listing many elements and/or rendering view based on big .json data.

When you're not working on some big web app - cordova will be perfect for your requirements. It's easy to maintain one codebase and there are no problems in uniforming your app to behave and look the same on many platforms.

Security can be a problem sometimes, but in most cases you can write or use existing plugin that helps for example storing secure data (like passwords) or performing https calls.

As you are native developer, it will be good to try cordova out and see how much time it will consume to develop something. From my experience (I'm not very fluent in mobile app coding) working with cordova is pretty fast.

If you have any questions, go on I will try to help! (sorry for bad english)

palucdev
  • 316
  • 3
  • 10
1

I'm in the same shoes and these things worry me about Cordova:

  • Documentation is obsolete. For example, since early 2019 they have support for "browser" platform but there is still no documentation for it.
  • Many plugins are abandoned. For example, https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin plugin for sharing files is recently recommended for use on StackOverflow. It has 75K monthly downloads and 399 active issues which aren't addressed.

So, Cordova will help you start quickly, but may become pain to use later. You may spend too much time fighting with Cordova's bugs, figuring out how it should work and fighting with bugs of its plugins. Personally, I'm going to build a native app using WebView and WKWebView, and take some parts from Cordova if they are useful.

I'd also consider PWA instead. Now, you can even share files from your web app or accept shares on Android.

Ivan Nikitin
  • 3,578
  • 27
  • 39