How to ? - Cordova Dev setup

How to ? - Cordova Dev setup

Hello,

Was a user of AppMobi before it was acquired by Intel, this is my first look at this product again, so these questions are largely related to being unfamiliar with the current capability of the XDK framework and implementation/support of Cordova.

My current Q is the recommended way to setup to build a Cordova (Phonegap) app. I see the "new" Build options but I'm puzzled Cordova support is only at the Build step. I would think it'd be very natural to require Cordova code implemented during initial Project setup so as to be able to create the code that might later be built to various target platforms.

Ordinarily, if I want to build a cross-platform app which requires special hardware access, I'd build an app with Cordova hooks available from the beginning. Should I approach such an app this way, or does the XDK framework provide similar hardware access without using Cordova? If Cordova is required, does this mean I should set up a Cordova Project on my local machine first, then import into an XDK project?

Along the same lines, although I read a feature description somewhere about jQuery Mobile support, since a default XDK Project setup again does not automatically insert jQuery Mobile code, I assume that is implemented the usual way manually by declaring in the <head>.

TIA,

Tony

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

After catching up with new developments in Cordova,

It seems that it's not possible to install Cordova plugins without first configuring build support for specific platforms. This raises a "chicken or egg" regarding the idea of building a Cordova project locally before importing into the XDK, is the XDK pre-built for with <all> the standard plugins, and is there is a means for installing new plugins? For that matter, is it possible to list supported plugins? Or, at least documentation that describes this?

Bottom line to address many uncertainties, some documentation that describes how to setup a Cordova project including how to implement Cordova plugins is needed.

Tony S

For documentation regarding how to setup for a Cordova build, see the middle of the "Build" section on the main doc page (http://www.intel.com/software/xdkdocs). You'll find references to several articles regarding the Cordova build options.

Regarding the Cordova API and the XDK -- the core Cordova 2.9 API is available as part of a "Gold" build using the traditional builds (the ones you used when it was part of AppMobi). The Cordova for Android and other beta builds currently support Cordova 3.3 and the respective core Cordova 3.3 APIs. Likewise for the Crosswalk for Android build.

We are moving to the Cordova build system as our default. The process of building against Cordova will simplify as the product progresses.

The emulator already supports the core Cordova API, as does App Preview and App Preview Crosswalk. So while it may not be obvious, the core Cordova APIs are available via any and all of the build options.

Cordova plugins will be supported shortly (as in the very near future). However, Cordova plugins will only be supported in the Cordova builds and, eventually, in the Crosswalk for Android build. Cordova plugins will not be supported in the original build system (that which was originated by AppMobi).

Thx Paul,

I don't know if I'm mis-reading either the reference you quoted or the Cordova documentation, but they don't gybe.

The conflict in documentation and concepts might be related to reading the latest Cordova release documentation (which may or may not be supported by the XDK Build service). Compared to what I read before, now <all> Cordova functionality is implemented as a plugin whereas I remember a year ago plus there were core Cordova functionality and then maybe optionally extended. The new architecture likely eases and makes the plugin method more consistent and reliable. At the very least, instead of the old days when I had to declare Cordova functions as available in a script, it seems that today that is replaced by the Build configuration.

Also, the new/current Cordova documentation describes a sequence installing locally which starts with targeting Build platforms before setting up the individual projects, so the "Build" no longer is an independent step at the end, it has to be setup properly from the beginning before you even create a project.

Also, I don't know what file structure the XDK will expect. My original thought was to setup a Cordova project locally and then copy the base files and file tree to the XDKI project but because of this new Cordova setup sequence is problematic.

Bottom line, either the XDK needs to have a one-button setup option that sets up the Cordova project consistent with its Build configuration or Documentation must be provided how to do this manually.

Thx, Tony

 

 

 

 

Hi Tony,

In the "standard" builds the entire Cordova 2.9 API is present (which is the "old" Cordova system you described). Cordova 2.x plugins cannot be added to that build, you just get the "core" Cordova APIs with that build.

In the new Cordova builds we use standard Cordova CLI (v3.3 at the moment) and Cordova 3.x plugins will be supported (when we enable that feature).

If you've got an existing Cordova CLI project you can overlay the XDK on top of it without disturbing your ability to continue to use Cordova CLI. Just "import" the project into the XDK by pointing to the main Cordova project directory (you may get an error about a missing index.html file, that's okay) and then change the "source directory" on the Projects tab to point to the www directory inside your Cordova project. The XDK will add a project.xdk and project.xdke file to your main project directory (which Cordova CLI will ignore) and once you point the XDK "source directory" to the www directory inside your Cordova project the XDK will be happy because it will see the index.html file you've got tucked away inside that project directory.

The XDK will push ALL the files inside the www directory to the build system in order to perform a build, whether you choose to use the "standard" build or the new "Cordova" build option or the Crosswalk build option.

Cool,

Thx Paul.

Hopefully last Q for the time being... As of this post, the current Cordova version is 3.5. Is there an easy way to check the Cordova version supported by the XDK? I expect to install and manage, create projects locally using npm for management, then push the project up to the XDK. This approach will generally require the XDK to be more or less current with whatever is the stable release from the Apache Cordova project.

Tony

Leave a Comment

Please sign in to add a comment. Not a member? Join today