I was going through the PhonGap Documentation
about how to package your HTML/JS/CSS
to a platform specific "native app"
. They have maintained separate documentations for the separate Cordova
versions which seems fine.
I essentially understand most of the things there. But the confusion I have is the disparity or the loss of information in the documentation from the older ones to the newer ones. For an instance, if you take a look at this documentation for the version 2.1.0
about setting up the android project and scroll a bit down, they have mentioned such things:
- In the root directory of your project, create two new directories:
- /libs
- assets/www
- Copy cordova-2.0.0.js from your Cordova download earlier to
assets/www -
Copy cordova-2.0.0.jar from your Cordova download earlier to /libs
-
Copy xml folder from your Cordova download earlier to /res
….
- Change the class’s extend from Activity to DroidGap
- Replace the setContentView() line with
super.loadUrl(“file:///android_asset/www/index.html”);
… and so on which clearly mentions the steps to follow while migrating or creating an app for a specific platform. But upwards from the version 2.1.0
, these information are missing.
Like in the newer documentations, all they have is just the regular android setup stuffs and android hello world
which we can obviously find on the official android documentation. I tried searching the whole documentation for that version and I could not find any information regarding the steps I mentioned above in the older documentation.
Otherwise how are the readers supposed to know those steps? Am I missing something here or have they provided?
PhoneGap is constantly being improved upon, and one aspect of the platform that has continued to see development is initializing a project. As new versions are released, there have been steps taken to automate and make this process easier.
In PhoneGap 2.1.0, as you’ve noted, it appears as if none of the initialization process was automated. The documentation that you linked to describes the steps to set up a native Android project. The developer is then instructed, as you described, to modify this project manually, adding the source files, libraries, and folder structure necessary for PhoneGap to function.
The PhoneGap version that I’m most familiar with is 2.5.0. The getting started guide for this version can be found here. In 2.5.0, the developer is directed to navigate to a specific directory in their Cordova distribution and run a script from the command line. This script takes arguments relating to where your project will live and some other metadata about it, then creates the native project for you and performs the aforementioned steps of creating the PhoneGap specific project structure and adding the source files. In addition, it starts you off with a test application, which you can examine and run to start you off, basically their version of “Hello World”.
I haven’t had the opportunity to use PhoneGap 3.0.0 yet, but it appears as though they’ve made our lives as developers even easier by moving the bootstrap process from a script to a program installed using node.js’ npm. The usage is mostly the same as 2.5.0, where you pass the metadata about the program you’re developing to the script, but now you can run it from anywhere, instead of needing to find the script deep in your downloaded cordova files. I suspect this process will result in something similar to 2.5.0, where the entire project structure is created for you, including relevant PhoneGap source files, with a helpful “Hello World” type program to get you started.
So, in summation, these parts of the documentation that you describe have been removed because PhoneGap has automated their bootstrap process and now does all this work for you!
If you’re interested in seeing some of the further differences between versions of PhoneGap, you can view or download their project, including the documentation, on github. They tag each version increase, so you can revert to one of the tagged commits to go through and see everything that’s different in the source code and docs from release to release.
4