One of the greatest challenges of a software development company working with iPhone and Android apps is time to develop on both platforms. While native programming these devices has its positives, rapid deployment of software is crucial in maintaining a profitable business model.  Using Cordova (PhoneGap) to achieve this, we have realized 200-300% reductions in time to market. Several of our apps run on Cordova and are available in the Apple Store, Google Play and Amazon.

Cordova allows you to keep one set of source code for both platforms, utilizing HTML and JavaScript.  This means you can simply develop your software one time for both devices and deploy.  Cordova comes with a breath of plugins from camera management, screen rotation, keyboard pop up, uploading file and more.  You install Cordova, add required plug-ins and develop.

Cordova is available here http://cordova.apache.org/

If you really want to speed up design time, you can actually develop your phone or tablet app on a website, using Chrome, FireFox or Edge.  Utilizing the CSS and HTML power of real time editing, you will see many apps can be produced in 1-2 days.  This allows for greater profit margins, less stress, and an ease on deadlines.

We have developed a technique to do just that.  By using the code below, you will disable Cordova (PhoneGap) in the browser view.  Then you upload the www project files to a website you have control of and can edit it right there.

var isApp = document.URL.indexOf( ‘http://’ ) === -1 && document.URL.indexOf( ‘https://’ ) === -1;

if(isApp){

                loadScript(‘cordova.js’, function(){  })

}

This code works by checking the URL of the device.  When running in app mode (on a device) the system does not use http protocol.  When in the browser we do.  This code simply checks to see if we are on a browser or not, then includes the cordova.js file.

This will allow you to program your app without the errors in the console on a website.  To continue to speed up development, we utilize jQuery.  If you are not familiar with jQuery, it’s a library of incredible useful shortcuts and tools for JavaScript.

jQuery may be downloaded here http://jquery.com/.

I highly suggest you rip out much of the default code that comes as a new project in Cordova.  The only thing you really need to include is the cordova.js file.  Using simple document ready function for the JavaScript replaces the cumbersome device ready code provided in the project.  Using jQuery $(document).ready() will fire when the page is loaded.

Using a combination of the process above, one should be able to rapidly deploy apps for home or business use, in a stable and reliable environment.  One of our big concerns when we first started this process was how Apple would react to an app not “natively” programmed in XCode.  The team at Apple will not reject your code because you used Cordova.  We have multiple apps in the Apple Store programmed using Cordova.  Give it a try, you will not be disappointed.

Creative Programs and Systems, CPS, is an all-inclusive IT solutions company offering a variety of services including: managed IT services, IT consulting, residential computer services, custom programming, website design, iphone & android app development, and more.  More information can be found at https://cpsmi.com.