4

In my Cordova app how can I test if Crosswalk (https://crosswalk-project.org/) is correctly integrate? And how to use it to display a web page?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
user1269586
  • 372
  • 1
  • 6
  • 27

2 Answers2

3

I had difficulty working with the crosswalk cordova examples provided by intel.

Joe Bowser, Android platform lead on Cordova, did a proof of concept, and keeps it here: https://github.com/infil00p/cordova-android/tree/pluggable_webview

Follow his readme to get up and running with crosswalk and cordova in no time.

To ensure that you are actually in the XWalk environment, you can use navigator.userAgent

a log of navigator.userAgent in Chrome yields:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/36.0.1985.125 Safari/537.36

checking navigator.UserAgent in the xwalk environment should have Mobile Crosswalk/5.34.104.2 in the resulting string

edit formatting

Lorenzo
  • 413
  • 2
  • 8
  • once crosswalk is integrated will super.loadUrl("file:///android_asset/www/index.html"); do the trick or do we have to use some other method to use crosswalk's webview – Vishnudev K Jan 22 '15 at 13:13
0

If you don't want to do code changes to confirm, you can always use Google Chrome and do remote debugging

chrome://inspect

Ensure your app is running on your device and it's connected to your development machine. Once running, go to the Console tab and you can paste the following:

navigator.userAgent

This will output something like

"Mozilla/5.0 (Linux; Android 5.1.1; GT-N7100 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.91 Mobile Crosswalk/11.40.277.7 Mobile Safari/537.36"

You can see Crosswalk in the outputted text.

Daniel Maclean
  • 779
  • 10
  • 21