Hi,
Thank you for the recognition on Crosswalk performance!
The Apache Cordova Android 4.0.0 release adds first-class support for
Crosswalk. In theory, if you add Crosswalk to replace the default system
WebView, there will be no performance lose.
$ cordova plugin add cordova-plugin-crosswalk-webview
Crosswalk team tried to make sure core Cordova plugins work without issues, but
honestly there might be compatibly issues between third party Cordova plugins
and Crosswalk, it’s better to add the plugins you have to. Crosswalk team can
fix those issues if they’ve been confirmed as Crosswalk bugs, for code defects
of the plugins, we have to request the plugin owners to fix them.
Basically there are corresponding settings and APIs map to some of the
manifest.json fields in Cordova API:
For specific orientation you interested, you can add lines below in global
preferences in config.xml file of Cordova project.
<preference name="Orientation" value="landscape" />
<platform name="android">
<preference name="Orientation" value="sensorLandscape" />
</platform>
For fullscreen you need, you can add <preference name="Fullscreen" value="true"
/> in global preferences in config.xml file of Cordova project.
http://cordova.apache.org/docs/en/5.0.0/config_ref_index.md.html#The%20config.xml%20File
If you need device orientation feature, there is a core plugin
cordova-plugin-device-orientation:
http://plugins.cordova.io/#/package/org.apache.cordova.device-orientation
Please don’t forget to add Crosswalk in your Cordova project or you will lose
performance and the bundled modern WebView support, you can check it via User
Agent.
$ cordova plugin add cordova-plugin-crosswalk-webview
Support for pluggable WebViews!
Crosswalk can be added by installing the cordova-plugin-crosswalk-webview
plugin.
http://cordova.apache.org/announcements/2015/04/15/cordova-android-4.0.0.html
BR
Belem
From: Dinde Games [mailto:[email protected]]
Sent: Thursday, May 21, 2015 2:28 AM
To: Zhang, Belem
Cc: Robert Norris; [email protected]
Subject: Re: [Crosswalk-help] How to handle the back button on the device ?
Hi,
Thank you for your answer ! It will definitely help me.
I'm more and more interested in cordova. especially to use different plugins.
How well does the crosswalk + cordova package work ? I saw it targets Android >
4.0 so that's fine by me, but I'm wondering if performances wise it's as good
as crosswalk alone ? (because it's damn good !)
I really don't want to lose those good performances from crosswalk.
By the way, after a little attempt, I noticed that when building the apk with
the crosswalk + cordova package, it doesn't take into account the
'manifest.json' file normally required in crosswalk. Is this a regular
behaviour ? If so that's a bit annoying because I used it to force the
orientation / fullscreen option, but I guess you can do it with cordova.
Best regards,
DindeGames
2015-05-19 8:35 GMT+02:00 Zhang, Belem
<[email protected]<mailto:[email protected]>>:
Hi Dinde,
Thank you for trying Crosswalk!
Robert is right, basically we need to override onBackPressed() in Java code, in
Cordova or Crosswalk extensions. Currently the easiest way is using Cordova.
document.addEventListener("backbutton", onBackKeyDown, false);
function onBackKeyDown() {
// Handle the back button
}
But if you don’t like it, I tried window.onbeforeunload at first, it works for
browsers but failed for Crosswalk app. Luckily, the “Back Button Detection
Object V 1.0.1” (by Brooke Bryan) helps.
<script src="http://www.bajb.net/code/backbutton/backfix.min.js"></script>
<script>
bajb_backdetect.OnBack = function()
{
alert('You clicked it!');
}
</script>
I tried it works on pure Crosswalk beta build crosswalk-14.43.343.4 with
hardware back key device, please make sure if it works on software back key
devices work in case any compatibility issues, the back logic/process need to
be think more.
Brooke Bryan
August 30, 2012
You are free to use the code wherever you like
Hope it helps, seems like the jQueryMobile tried to use this to detect if the
user clicked on the back arrow on an iOS or Android device in comments [2].
[1] http://www.bajb.net/2010/02/browser-back-button-detection/
BR
Belem
From: Crosswalk-help
[mailto:[email protected]<mailto:[email protected]>]
On Behalf Of Dinde Games
Sent: Monday, May 18, 2015 8:41 PM
To: Robert Norris
Cc:
[email protected]<mailto:[email protected]>
Subject: Re: [Crosswalk-help] How to handle the back button on the device ?
Thank you for your answer Robert.
The thing is I don't develop in Java, my game is a full javascript application,
so I don't have the possibility to change the activity directly. That's why I
wanted to know if there is a way (like a bridge) to do it in javascript. For
example I know you can do it with cordova, but I'd like to avoid it if it's
possible.
2015-05-18 12:21 GMT+02:00 Robert Norris
<[email protected]<mailto:[email protected]>>:
This is an Android function, nothing to do with Crosswalk. Override
onBackPressed() in your activity. See
http://developer.android.com/reference/android/app/Activity.html#onBackPressed%28%29.
Rob N.
On Mon, 18 May 2015, at 08:13 PM, Dinde Games wrote:
Hello,
I'm a beginner with crosswalk, and I'm using it to make a game (with Phaser for
those who know).
So, I use crosswalk (with the CLI, not with intel XDK) as my wrapper, and I'd
like to know how can I handle the back button on the android device ? At the
moment it quits the game withtout any warning, I'd like to prevent that because
the user could hit that accidentally, so I would like to write my custom
function in javascript but I don't know if there is a javascript event
available?
After some researches, I saw several answers about crosswalk with cordova, but
I'm not using cordova, and I hope I won't have to, because I don't really need
it and I try to have light apk in the end, and I don't know if it will affects
the performances of my game.
Thanks in advance !
_______________________________________________
Crosswalk-help mailing list
[email protected]<mailto:[email protected]>
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help
_______________________________________________
Crosswalk-help mailing list
[email protected]<mailto:[email protected]>
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help
_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help