How to solve "stuck partial wake locks"?

0 favourites
  • 13 posts
  • Hi guys!

    Since some time ago google ranks apps according to the performance. You can check how your app is doing in the vitals section in developer console.

    I get a really high value in the battery section (0.5% & lowest 2%) and google is telling me to do something about it. What can I do to decrease this number? How can I even detect what is wrong?

    There is a cordova plugin to disable wakelocks right? Should I use that plugin to solve this issue somehow?

    Any help is appreciated!

  • I have the same question

  • By default, Construct does not use a wake lock. If you switch to a different app or lock the device Construct will suspend the game so that it becomes completely inactive. (If you want a wake lock it's currently only supported by third-party addons, and yes, tends to needlessly hammer battery life.)

    Games are generally pretty battery-intensive: during gameplay the screen is continuously on, and both the CPU and GPU are working pretty hard to run the game, so a lot of the system hardware is powered up. I'm not sure there's much to be done about that. I suppose it could drop to half-framerate mode, but that makes the game look less smooth, and HTML5 doesn't have a good way to do that yet.

  • Thanks for the fast reply Ashley. Nice to hear C2 does not use any wake locks. Then it must be something I have done in my events that triggers this or a 3rd party plugin i'm using, correct?

    Here is a graph from my android vitals section showing the issue in one version of the app.

    This shows something in my app keeps the cpu active in some devices when it is in the background.

    BTW. This is only happening on devices running android 8 (maybe google only monitors this in the latest android though?)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello Ashley

    You said that the construct suspend the game so that it becomes completely inactive if we switch to another application or lock the device. But I have the same message about the "Stuck partial wake locks" issue in my Google Play developer console (for android 8.0 and up), and I found that it refers to the AudioMix tag. Perhaps this is due to the audio stream that Construct is created?

    I also found this, but maybe it's obsolete information:

  • radbrothers

    Did you find any solution? I've been looking all over the place for the root cause.

    It sucks because Google Play is downranking apps so hard right now because of this! Android vitals does not really give any helpful information about the issue either.

    Maybe we should just kill the app when it's suspended? That should solve this shouldn't it?

  • boulerzzz

    Unfortunately I did not find a solution. But I think that killing an application when it goes to the background is not the best solution. I found information that the developers on the Corona engine had the same problem, and its developers fixed it. Maybe Ashley and his team can help us with it.

  • radbrothers

    I'm a little bit curious.

    Do you get this in all your apps?

    What plugins are you using? I'm using the Firebase plugin from rexrainbow and cranberrys google analytics. Maybe one of these could cause problems?

  • Providing the Audio plugin's "Play in background" setting is disabled (the default), then Construct also suspends all audio playback when going in to the background. So that should not be a problem either.

  • Ashley

    I know about the Audio plugin settings, but this problem still occurs. I think this is a big problem for the developers of Construct, becouse this indicator very much influences the ranking of games in Google Play. My game was in the top 20 in several categories for a long time, but after Google began to take into account the indicators of "bad behavior", my game fell to the bottom and downloads fell by 80%.

    In the screenshot, you can see that the stuck AudioMix wake lock occurs at the beginning of the game session, perhaps when the game is loading and the engine starts to decode the sound, also many developers report that the problem appear when there are audio decoding threads. I tried to disable the "Preload of sound" in the project settings, but this does not affect the music so nothing has changed. Maybe if we disable also preload music, then this will change the situation, but of course these are my guesses.

    I think if developers of the Corona, Gamesalad and Cocos2d engines reported about this problem, then you need to pay attention to it.

  • I have no idea what this could be - our engine is specifically and carefully designed to stop everything and suspend any on-going work when it goes in to the background, including audio playback. Maybe it's something in the browser or Cordova? I don't know where to start looking.

  • Hi!


    If this still matters, this was solved when I disabled the preload of sounds in the project settings

  • That makes no sense: it only causes audio to load at a different time, and has no effect on the engine suspending the audio engine when going to sleep. The "Play in background" setting is the only thing that affects that.

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