By using Cordova, we can build a web application that can run on many mobile devices both iOS and Android. This post will show you all the basic required steps to do it.
NodeJS
First of all, to use Cordova, we need to install NodeJS. I won’t cover how to install NodeJS here. I assume we have NodeJS already. Next step is:
Installing Cordova
To begin installing Cordova, we run this command:
npm install -g cordova
Create the App
Then we create the app by creating a directory and its necessary files. To do it we call:
cordova create hello com.example.hello HelloWorld
After that, we see a folder has been created. Then we go inside that folder, we cd to it: cd hello
If you open the folder, there is a www folder inside it, we place our web files there and that’s all.
Adding platforms
Then we add platforms to our app, let’s say Android and iOS, so we run this command:
cordova platform add ios
cordova platform add android
Build it!
Then we can build the app by using this command:
cordova build
Or specifically we run
cordova build ios
Continue with Xcode or Android Studio
After building the app, we can open the built project using Android Studio or Xcode (it depends on what platform you are working on) then on these IDE you can build the app and publish it to Google Play or AppStore.