Sign in to follow this  
iprasila

Running HTML5 in a WebView on Android

Recommended Posts

Hello,

 

I was wondering if you guys have some experience with using PhoneGap/Cordova to package your game as an Android app. I've recently tested both Cordova and PhoneGap for a simple sprite draw on canvas on Android 4.4 and the it seems terribly slow compared with the same code in the Android Chrome browser.

 

Also, it seems that both Cordova and PhoneGap don't respect much the config.xml file settings. I've tried to force the game to run only in landscape and while there is this option in the config.xml it is not actually used by the CLI build tool. I've had to manually modify the AndroidManifest.xml in order to achive the desired result. Obviously, Corodova and PhoneGap still need a lot of polishing. 

 

Ion

 

Share this post


Link to post
Share on other sites

Have you tried CocoonJS?

 

Makes HTML5 games run really great on mobile.

 

Thanks for the suggestion.

Yes, I've already tried CocoonJS. I don't particularly enjoy the workflow, also I hate the idea that I have to be careful what part of the HTML5 is available when I run my app as a WebView or as a Canvas app ...

Share this post


Link to post
Share on other sites

What about Crosswalk? I haven't tried it myself but it's supposed to be much faster.

 

First impression is really good. A bit hackish  to find the documentation for the command line options :). Fortunately the configuration file is in Pyhton, you can always read the source.

 

I will need to do more tests, I'm really curious how many fps I can get on Android 4.4. Because of the new Chromium WebView, PhoneGap is really crippled on KitKat.

Share this post


Link to post
Share on other sites

I am facing the same issue here, using PhoneGap. I read, that the WebView on Android is not hardware accelerated, and that is the reason why it performs so badly.

But I am really stumped how slow it is, I am just moving a small single sprite on a canvas, and it's like a slide show.

 

I have to give CocoonJS a try, since their Demos from the Play Store are very fast and smooth.

Probably I am doing something wrong, or CocoonJS has some magic in store.

Share this post


Link to post
Share on other sites

I am facing the same issue here, using PhoneGap. I read, that the WebView on Android is not hardware accelerated, and that is the reason why it performs so badly.

But I am really stumped how slow it is, I am just moving a small single sprite on a canvas, and it's like a slide show.

 

I have to give CocoonJS a try, since their Demos from the Play Store are very fast and smooth.

Probably I am doing something wrong, or CocoonJS has some magic in store.

 

If your game uses Canvas only operations than CocoonJS will work just fine for you, if you mix DOM manipulation and Canvas ... well, you'll see.

 

I wouldn't blame PhoneGap, after all PhoneGap uses what Android offers as the default WebView class. PhoneGaps doesn't implement their own version of Canvas like CocoonJS.

Share this post


Link to post
Share on other sites

If your game uses Canvas only operations than CocoonJS will work just fine for you, if you mix DOM manipulation and Canvas ... well, you'll see.

 

I wouldn't blame PhoneGap, after all PhoneGap uses what Android offers as the default WebView class. PhoneGaps doesn't implement their own version of Canvas like CocoonJS.

 

Oh, I'm not blaming PhoneGap, PhoneGap is great. I think the Android WebView sucks (If I am not doing anything wrong).

 

Actually found a topic/discussion about this issue at the chromium project: https://code.google.com/p/chromium/issues/detail?id=315111

 

Maybe this is a solution: https://code.google.com/p/android/issues/detail?id=35739

Share this post


Link to post
Share on other sites

Oh, I'm not blaming PhoneGap, PhoneGap is great. I think the Android WebView sucks (If I am not doing anything wrong).

 

Actually found a topic/discussion about this issue at the chromium project: https://code.google.com/p/chromium/issues/detail?id=315111

 

Maybe this is a solution: https://code.google.com/p/android/issues/detail?id=35739

 

Hello,

 

it is currently possible to use Cordova with Crosswalk as backend. Basically, you will keep using the Cordova syntax except that the WebView in which your app will run will be based on Crosswalk instead of the default Android one. Using the default Android 4.4 WebView for e.g. I was only able to get 4-8 fps while with the Cordova + Crosswalk backend I get 40-60 fps.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.