I’ve been building out a webapp using react. It’s completely responsive and developed in device mode.
Once I was happy with it’s behavior in browsers I decided it was time to port it as a native mobile app. Below we assume the whole application has been compiled with Browserify or Webpack into an app.js file. I’m also assuming es6 syntax and inline styles.
First thing to note is that cordova has it’s own hooks for device lifecycle events. Checkout Cordova Events.
Specifically, we must delay execution of our webapp until the deviceready event executes. Wrap your applications entry point like so
Install the cordova cli tool npm install -g cordova
From your project directory
cd ..
cordova create <new dirname>
cd <new dirname>
cordova platform add ios && cordova platform add android
cordova plugin add cordova-plugin-device && cordova plugin add cordova-plugin-whitelist
ln -s ../reactProject www
cordova emulate ios
You’ll want to customize config.xml.
Especially the id, name, description and author tags. Read about ids
under Additional Versioning
.
If you plan on using git for this ignore the plugins/ and platforms/ folders.
The Google and Apple App Stores require additional information from your app.
Customize your Icons and Splash screens. Read Androids Graphics Assets page. Read iTunes Connect’s Screenshot Properties scroll to it.
Cordova Icon and Cordova Splash are useful for generating the images needed. You’re going to want an icon of size 1024 x 1024 pixels and a splash image 1242 × 2208 pixels.
To build an Android release cordova build --release <platform>
.
Then you have to sign the app Signing Android.
Google’s developer program costs $25.
For iOS I find it easier to use xcode to push to the app store.
Read Publishing iOS.
You’ll want to make an app ID and an iTunes Connect app profile. Both are accessible from developer.apple.com.
When you are uploading screenshots for your iOS store listing it’s useful to
know cmd + S
in the iOS simulator saves a screenshot to your desktop.
Apple’s developer program costs $100.
If you need help solving your business problems with software read how to hire me.