Jump to content

Anyone seen this Android 4.1.2 bug?


rich
 Share

Recommended Posts

Since Android 4.1.2 we've noticed an annoying issue in the stock browser that effects a number of games (not just ours) specifically on Samsung devices.

 

Basically when you touch the display, the game will freeze. It literally pauses for a while before carrying on. Almost as if it's expecting some kind of gesture, or trying to save an image or something. The delay is quite noticeable. I wonder if it's a change with listening for mouse/touch events? We've seen this happening across all Samsung devices we tested on (S3, S2, Galaxy Ace, etc) but only on Android 4.1.2.

Link to comment
Share on other sites

Got the same issue when BoosterMedia was testing one of my games on a Galaxy S2. I wasn't able to reproduce the problem since I don't have one, and I can't borrow my roommate's phone too often :-p

 

Maybe you should take a look at this: http://stackoverflow.com/questions/10246305/android-browser-touch-events-stop-display-being-updated-inc-canvas-elements-h

The solution requires to add a preventDefault() call on touch events on the document. I never knew if it worked for me though :(

Link to comment
Share on other sites

ya I just noticed this when popping into carphone warehouse to do some testing today - both a samsung tab 2 and an S3 mini had same freezing issue with stock browser (chrome was fine).  A normal S3 right next to the mini was fine.  Didn't see this problem on any other device/browser combinations.

 

preventDefault did not prevent the freeze and my listeners were: touchstart, mousedown, touchend, mouseup

Link to comment
Share on other sites

ya I just noticed this when popping into carphone warehouse to do some testing today - both a samsung tab 2 and an S3 mini had same freezing issue with stock browser (chrome was fine).  A normal S3 right next to the mini was fine.  Didn't see this problem on any other device/browser combinations.

 

preventDefault did not prevent the freeze and my listeners were: touchstart, mousedown, touchend, mouseup

touchmove is probably more important. Did you try?

Link to comment
Share on other sites

I finally have an android device to test with and after faffing about for hours I still can't solve this.

 

I've checked a few html 5 games on the web and most seem to have the same freeze issue - I noticed that a few games made with createjs seem to be immune so I had a peek at how it was dealing with touch events

 

couldn't see anything too different to what I was already doing - but I plumbed in the touch code from easeljs to see if it would make a difference (to no avail - still freezes).  Not sure what else in the use of createjs is making it work without further investigation

 

I also tried overriding all touch commands at the document level and applying the game touch events to a div but no difference

 

I wondering if it's something set in the html causing the issue - a style or viewport parameter?

 

what I'm surprised about is that there is very little information about this on the web for what seems like a real deal breaker for anyone making games/interactive content for android

Link to comment
Share on other sites

  • 5 months later...

Hi Guys, im running content for www.a10.com (m.a10.com, t.a10.com)
Is there already a fix for this particular problem? We notice similar behavior for some of our games.
A big portion of our users are running android 4.1.2 using stock browser.
Would be happy to hear back from you.
Regards

Link to comment
Share on other sites

I've recently run into this, and drawn up a blank - no idea how to resolve it:

 

http://www.bbc.co.uk/cbeebies/tee-and-mo/games/tee-and-mo-face-painting/

http://www.bbc.co.uk/cbeebies/tee-and-mo/games/tee-and-mo-picture-perfect/

 

I investigated a DOM rendered alternative approach, because I can see in my case that another DOM rendered CSS anim occurring on touch move was still correctly rendering. This turned out to be inconclusive until I had to park things for another day though.

Link to comment
Share on other sites

There's no fix. I guess Samsung don't care because 4.1.2 is "old" for them now. None of their current phones ship with that version (and haven't done for months now).

 

None of my Samsung devices have 4.1.2 on any more, they've all auto-updated now. I suspect it was just some stupid bug in stock browser they fixed some time ago. They are always doing daft things in their browser, this is just one of many Samsung related issues.

Link to comment
Share on other sites

  • 3 months later...

I actually solved this issue accidentaly... but its not logical at all :/

Mentuat's guess was right. Obviously it has something to do with set Viewports and CSS. I am not sure why it is working but i'll give you what IS working.

 

If found out the following.

 

1: Don't give the canvas an absolute position or even better no css styles at all.

2: Leave any PARENT elemnts css default, leave everything default no css reset NOTHING !

3: Set the Viewport like  <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

4. You can set the canvas position relative to alter its position

5. You can set absolute positioned controll buttons or anything onto the canvas should still work

 

So basicaly if you dont know why it is not working... just create a clear HTML5 page with NO CSS AT ALL !!! and just set html width/height and add the viewport meta tag as given  :)

 

Would like to hear more about this from you guys :)

Link to comment
Share on other sites

  • 3 months later...

I've solved this problem in my games by including this in the <head>:

<meta name='viewport' content='width = device-width, initial-scale=1, maximum-scale=1.01' /><script>window.addEventListener("load", function() {   function onTouchPreventDefault(event) { event.preventDefault(); };   document.addEventListener("touchmove", onTouchPreventDefault, false);   document.addEventListener("touchstart", onTouchPreventDefault, false);}, false);</script>

I've tested this on my S3 stock browser and it works fine now. Without the code I get canvas freeze on tap.

Link to comment
Share on other sites

I've solved this problem in my games by including this in the <head>:

<meta name='viewport' content='width = device-width, initial-scale=1, maximum-scale=1.01' /><script>window.addEventListener("load", function() {   function onTouchPreventDefault(event) { event.preventDefault(); };   document.addEventListener("touchmove", onTouchPreventDefault, false);   document.addEventListener("touchstart", onTouchPreventDefault, false);}, false);</script>

I've tested this on my S3 stock browser and it works fine now. Without the code I get canvas freeze on tap.

 

Has this any effect on other browsers like Chrome...?

Link to comment
Share on other sites

does seem to work well - nice one!

 

edit: on further testing, it's effective on stock browser on Samsung S3 mini with Android 4.1.1 (and the only part needed was  'maximum-scale=1.01')

 

Unfortunately the trick doesn't work on a Samsung Tab 2 with 4.1.1

 

odd!

Link to comment
Share on other sites

does seem to work well - nice one!

 

edit: on further testing, it's effective on stock browser on Samsung S3 mini with Android 4.1.1 (and the only part needed was  'maximum-scale=1.01')

 

Unfortunately the trick doesn't work on a Samsung Tab 2 with 4.1.1

 

odd!

 

Very odd. Gotta love the stock browser...

 

True about the maximum scale. Just be sure to preventDefault on the event if you arn't using Phaser.

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...