A while ago, I was looking at ways of developing mobile applications and found about Apache Cordova.
Apache Cordova is open source software so it allows non-Adobe wrappers around it, including Phonegap, and others such as Intel XDK or Appery.io.
The application runs on the mobile device and can access the native functions of the device such as the GPS or camera. By using the Cordova APIs a developer can build a mobile application without writing any native code.
Building Apps with NetBeans
After digging a bit, I found a tutorial on the NetBeans site that showed me how to set it up to develop and create native applications.
After completing the process, I was able to create, build and test the application (a very simple, hello world app, to see how it worked).
Example Android App
Once I was acquainted to Apache Cordova, I started a new project. I used river-height data coming from Santa Fe’s Weather Information Center (CIM) and displayed it on a Google map.
This involved accessing a Web Service and using Google Maps’ API to display each measure point data on the map.
However, when working on the App, trying to access native hardware functions (through the use of plugins), I noticed that all Cordova-related code was fetched from Github repositories every time I ran the compile cycle, as shown in the plugins.properties file.
org.apache.cordova.device=https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git org.apache.cordova.network-information=https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git org.apache.cordova.geolocation=https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git org.apache.cordova.splashscreen=https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git org.apache.cordova.file=https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git org.apache.cordova.dialogs=https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git org.apache.cordova.file-transfer=https://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git
Working with local code repositories
Although this had the advantage of fetching the latest code, it did take a long time to get, even for small code changes, making the debugging process much slower.
While reading NetBeans documentation, I found that it was possible to modify the project’s settings to get code pieces from local folders, as described below.
org.apache.cordova.device=C:\\git-repos\\cordova-plugin-device org.apache.cordova.network-information=C:\\git-repos\\cordova-plugin-network-information org.apache.cordova.geolocation=C:\\git-repos\\cordova-plugin-geolocation org.apache.cordova.splashscreen=C:\\git-repos\\cordova-plugin-splashscreen org.apache.cordova.file=C:\\git-repos\\cordova-plugin-file org.apache.cordova.file-transfer=C:\\git-repos\\cordova-plugin-file-transfer org.apache.cordova.dialogs=C:\\git-repos\\cordova-plugin-dialogs
This simple change made the app-creation process much faster, as Cordova-related files were fetched from a local folder, avoiding any network overhead.
This also allowed the Apache Cordova development process to go on even if Internet access was severed, making it ideal in unstable-connection situations. Once the testing cycle was over, I could switch back to Github-based sources, so that the App used the latest code, solving any potential security or performance problems.Wa