Screen Timeout Issues. How to prevent this or fix?

0 favourites
  • 5 posts
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • First time asking for help on here, so hopefully this is the right place. <img src="smileys/smiley5.gif" border="0" align="middle" />

    I have a cloud compiled CocoonJS app that I'm testing on Android devices. The issue seems to vary from device to device, but basically here's what happens. When the screen times out, the game breaks in some way. Unlocking the device to resume the game has varying results: screen goes completely black or white and won't resume, the graphics get either shrunk, offset, or streched oddly making it unplayable, or the device locks up completely, requiring a reboot. Most of the time, it just takes hitting the back button to exit out of the app, and relaunching it to get things back to normal. (Note: On my Android tablet, it works great and I can even swap between other apps and back to it, and it'll resume properly.)

    Has anyone else experienced any similar problems with resuming their games, after the screen times out? Does anyone have any tips for a workaround or is there a way to prevent the screen from timing out?

    The two devices I've tested this are on Gingerbead Android 2.3, and maybe it has to do with the lock screens being in the portrait orientation... so, that when it tries to resume the game, you'll see it switching to the landscape orientation and that's when things break. (My tablet is running Android 4.0 ICS, and the lock screen is landscape orientation, so maybe that's why it works?) I'm using scale mode with an oversized background sprite, and some anchored sprites.

    I can post a capx file later tonight if that'll help. Similar behavior can be found even when letting the screen timeout while in the Cocoon JS launcher, so it'd be easy to verify.

    *EDIT*

    Added some screenshots of the Before and After to clarify the issue.

    Before

    <img src="http://howardconcepts.net/internets/construct2/game_1_before_timeout.jpg" border="0" />

    After

    <img src="http://howardconcepts.net/internets/construct2/game_2_after_timeout.jpg" border="0" />

  • I'd probably ask ludei about this.

  • Yeah, I think I'll put an inquiry into them tonight. Maybe try to capture some screens or a video of it to help clarify. I'm trying to get more feedback from other users on their devices to see if there's a common step to reproduce.

    I was mostly just wanting to check with the community first. I'm not sure if other users testing their apps on CocoonJS would normally test for this. I have my timeout settings really low to save battery, so I discovered the issue pretty quickly.

    If anyone else gets a chance and wouldn't mind running a quick test on their app in the CocoonJS Launcher, let the screen timeout, and see if things are stable upon unlock and resume, I would greatly greatly appreciate it! <img src="smileys/smiley31.gif" border="0" align="middle" />

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry to spam my own post, but it does seem to be a lock screen/orientation related issue. I mentioned that the game resumed properly on my tablet, because it locked in landscape and the game plays in landscape. Well, I decided to test it in portrait mode and got some results.

    Before Display Timeout

    <img src="http://howardconcepts.net/internets/construct2/tab_portrait_1_before.JPG" border="0" />

    Lock Screen After Waking Device

    <img src="http://howardconcepts.net/internets/construct2/tab_portrait_2_lock.JPG" border="0" />

    The After

    <img src="http://howardconcepts.net/internets/construct2/tab_portrait_3_after.JPG" border="0" />

  • I'm pretty sure this is a CocoonJS bug. It sounds like they are not handling the lost context event properly, which means if the device goes to sleep and wakes up the game state is lost. It's possible to fix it - you need to ask ludei to do that though.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)