I am building an hybrid android app using crosswalk webview as my app needs webrtc support. I have a query in my mind as cordova webview is not stable over android versions and also do not have webrtc support therefore we add crosswalk plugin ,then why not use use crosswalk standalone . In this case we will also have some control over native features of android. THen what is the advantage of using cordova + crosswalk over using crosswalk webview alone.
You can do it, I have and there are some things you need to be aware of.
You will run into errors, the crosswalk community is way smaller, and therefore some solutions to your errors will be harder to find in the usual places.
Then you will have to make some decisions (space-wise). In crosswalk you have Shared and Embedded modes.
https://crosswalk-project.org/documentation/shared_mode.html
You will run into some trouble with embedded mode and testing with x86 and 64-bit phones. (You need to change your gradle dependency to 64-bit).
With proguard and architecture splits you can package your app to a "reasonable" size ( under 40mb ), depending on the contents of your assets folder. (Embedded mode)
As a java developer, I don't see the advantage of using cordova + crosswalk in most projects, but I do wish that the documentation available for crosswalk would be updated more frequently.
To get started, add this to your gradle file:
repositories {
mavenLocal()
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
}
dependencies {
compile 'org.xwalk:xwalk_core_library:20.50.533.12'
}
Cordova is a complete HTML5 development framework with plenty of plugins that can help you to use Web API to do some works that only native code can do originally. By default, Cordova is using the system WebView on Android.
In contrast, Crosswalk is a HTML5 engine with the main purpose of being more powerful WebView. If you're developing pure web application, Cordova is the recommended way and you can replace the system WebView with Crosswalk by installing the Crosswalk plugin. But if you already have lots of native Java code and want to build a hybrid application, it's more convenience to use the embedding API of Crosswalk directly.
If you do that you are basically repackaging a website into an app. I don't know about Android, but Apple will not approve your app for sure, which defeats the purpose of using a hybrid framework anyway.
Related
I have an angular 7 project deployment which runs fine on apache. I like to
use it on android app. After some study, a server like cordova is necessary
for android platform. nativescript is also an option. I really like not to
have cordova bundled in android app. Is it true that I can not use angular 7
deployment directly on webview app? I have several app run on angularjs 1.x which
is working great.
any comment would be appreciated.
Cordova is NOT needed and you can easily use your Angular deployment inside the webview of
android/iOS app.
Cordova is not a server, but it provides the below
CLI to create and manage android/iOS projects and also generate the apk/ipa (app binary). So, with your angular depoyment, you can generate both iOS and android app with single CLI.
These created projects uses webview internally, so all your HTML resources are rendered inside webview.
Plugins interface to communicate with native modules. There are plugins available for automated codepush too.
Finally, if you can maintain your android/iOS app yourself, and all you want is just rendering your HTML app inside webview, you do not need Cordova.
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:
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).
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/
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.
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.
This guy on youtube produced a nice, straight-forward tutorial that worked for me: https://www.youtube.com/watch?v=0I1OjJLVLMo
The results are fantastic, worth the struggle to get it working.
The guy says CrossWalk makes a big difference on anything running less than Android 4.4 (when Chromium was added).
Good luck.
I have created an ios app using Xcode .Now I have to make it run on android also.So I downloaded phonegap 2.0 and create an xcode project using commandLine(./create ~/Desktop/newfolder com.companyname.projectname projectname).After that I added all the required classes and storyboard file of allready created ios project to this new one(created by using Phonegap utilities).
And now I can run this project.What I want to know is ,
Is this the correct way to make my ios app cross platform?
Is there any rule that only app created using CSS html5 and
javascript can be made crossplatform using Phonegap?
If my steps are wrong do I need to create the same project using CSS html5 and javascript again for making it cross platform.
You can't achieve such functionality using PhoneGap, here is the wikipage for PhoneGap
It says that it enables software programmers to build applications for mobile devices using JavaScript, HTML5, and CSS.
PhoneGap has different builds for different architectures, so once you've written your entire app using HTML5, CSS and JavaScript you can make build for every different platform available.
If you want to port iOS project into android it is not possible but if you want to port a HTML5 application you can do it using PhoneGap.
Create a PhoneGap project for android using command-line interface. Have a look at the Cordova Command-Line Interface.
Add the CSS, Javascript, HTML, image files inside respective folders. Also, add plugins required for the application using the command-line interface.
Hope it helps you.
First off the bat, if you're looking to port an existing Objective-C based iOS project then it is not possible to do so with PhoneGap.
PhoneGap or Apache Cordova as it is known now is not the only framework that can be used to write cross platform apps. I personally think it is one of the more well supported ones (being an open platform) and yes it is based on familiar web technologies i.e. HTML + CSS + Javascript and you are limited to using only this combination but then web frameworks are good enough for most development requirements these days. This is a good place to start off with Cordova development.
Cordova 3.x.x onward has matured well as a framework and post creation of a project one can add platforms using the command line interface (CLI). This is the common structure of a Cordova project :
/hooks /merges /platforms /plugins /www config.xml
The /www folder contains the web app that you're developing, typically :
/img /css /js index.html
The /platforms folder contains the projects for the various platforms that you've requested, typically :
/android /ios
It is these folders that contain the projects that need to be imported by the IDE that you're using. Say, for Android, import the contents of the android folder as an Existing Android Code Into WorkSpace and build it normally as an Android project. That is all.
Nonetheless, it has many limitations like the lack of support for in app billing, 3D graphics etc. I would like to suggest that you consider making native apps for all platforms you intend to support.
just wanted to clear a confusion concerning phonegap,
My area of interest is mainly Android and Iphone. What I really understand about phonegap is that the phonegap app is platform independant when no native libs are ysed and thus run both on iphone and android. Thus if i build an android app on eclipse using phonegap without using any native libs, will it run on iphone as well??
Nope, this is not exactly the case.
Phonegap enables you to write cross-platform code (HTML, JS, CSS), but when it comes to building, you have to compile this code to a specific environment for each OS. For example you can build the Android version using eclipse, and the iOS version using Xcode.
Hope this helps!
No, you will still need to build for iPhone as well.
You can use the same source code for all systems.
I've been trying the code Google provides with Android source code for a Browser Plugin, more specifically, following this README,
https://www.codeaurora.org/git/projects/qrd-gb-dsds-7225/repository/revisions/cc99b832a941dc8cbb86f1607d04eb87935ddbfd/entry/android/development/samples/BrowserPlugin/README
My question is, will I need to distribute a separate plugin for each platform(Froyo, Gingerbread, Honeycomb, etc)?. I'm planning to include native code within the plugin.
Thanks in advance!