Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to combine Cordova, Crosswalk and Ionic framework

I'm trying to create a mobile application which combine the above projects and I'm not sure how should I do it.

Here are 2 options which I found:

  1. Use https://github.com/MobileChromeApps/mobile-chrome-apps - My problem with it is that it seems that it's not production ready. (I was told that it is but I can't find any support for that).
  2. Create a new ionic project, then add Cordova to it followed by empting the platforms/android/CordovaLib/ folder and moving into it files from Crosswalk (as explained at https://www.thepolyglotdeveloper.com/2014/10/use-crosswalk-ionic-framework-android-apps/) - This solution is quite simple but seems a little hackish for me...

Which option should I use? are there any other options?

Cheers,

---- Update ----

Ionic have incorporated the ability to combine Crosswalk in their own CLI, check it out at http://ionicframework.com/blog/crosswalk-comes-to-ionic/

like image 340
Nimrod Yonatan Ben-Nes Avatar asked Nov 06 '14 09:11

Nimrod Yonatan Ben-Nes


People also ask

Can I use Ionic with Cordova?

Since Ionic is an HTML5 framework, it needs a native wrapper like Cordova or PhoneGap in order to run as a native app. We strongly recommend using Cordova proper for your apps, and the Ionic tools will use Cordova underneath.

Which is better Ionic or Cordova?

Ionic provides frameworks to use in the application. Whereas Cordova provides plugins to run the application similar to the native app. Ionic provides many different functions, which need to be integrated with the application, whereas Cordova provides the hardware access of a device to the application.

Is Cordova and Ionic same?

Ionic started working on a new native runtime to replace Cordova that was fully built in house and deeply integrated into the Ionic developer experience: Capacitor. And then a year later, Ionic Framework added support for its first non-Angular framework: React (and later, Vue).


2 Answers

Regarding Crosswalk

Crosswalk support is something that we hope will be available to vanilla cordova by default before the end of the year. You can start experimenting with this today by following the work on the cordova-android 4.0 development branch. It should be possible to add this platform (and the required plugins) directly to a new ionic project.

Chrome Apps for Mobile are cordova-cli compatible and do indeed already bundle Crosswalk by default. The primary difference with vanilla cordova is that applications must follow the Chrome Packaged App structure (have a manifest and background script), but gain the benefit of running on Desktop Chrome. See longer answer here. (I wouldn't read too much into the developer preview label.. we just like calling everything beta ;)

The current crosswalk-project.org provided cordova workflow does not use a cordova multi-platform application structure. It uses the cordova-android native app template directly. This means you will not be able to use the cordova cli, nor downstreams like cca or ionic. You will also obviously not be able to add other platforms, will have a tougher time upgrading, and managing plugins is a bit more complicated (you have to use the plugman tool directly).

There is currently no option for developing using cordova+crosswalk that is not without some tradeoff.

Regarding compatibility between Cordova, Ionic, Chrome Apps for Mobile (etc) projects

Most cordova downstream projects are "mostly" cli compatible. E.g. The cca cli (used by Chrome Apps for Mobile) supports commands like create, plugin add and platform add -- so it will work to install ionic plugins. Vice versa is also true, Chrome Api's for Mobile are developed as cordova plugins which can be added to an Ionic or cordova project using their respective cli's.

Most downstreams also use the same project directory structure (plugins/, platforms/, www/, hooks/, etc), so you can usually mix usage of the various cli's within one project to some degree.

That said, the reason cca needed a custom cli is because we do a few non standard modifications to your cordova project that aren't directly supported by vanilla cordova (yet). Ionic does the same.

I've suggested at various cordova meetups that downstream projects like Ionic, PhoneGap, and CCA, should play better together -- so your question is right on the money. We are mostly-compatible but finding out the differences is currently left as an exercise to the developer.

like image 138
mmocny Avatar answered Sep 18 '22 20:09

mmocny


Using XDK HTML5 Cross platform Development IDE is probably the best way of integrating Crosswalk, Cordova and Ionic. It has built in support for Crosswalk. I have recently used it and its totally awesome. It will make our work a lot easier.

From Crosswalk site:

If you prefer to use a graphical integrated development environment (IDE), the free Intel XDK provides an alternative way to package applications for Crosswalk Android. See the Intel XDK website for more details.

like image 37
Bipin Bhandari Avatar answered Sep 17 '22 20:09

Bipin Bhandari