Keeping mobile app awake / prevent screenlock

0 favourites
From the Asset Store
Basic template for any App you'd like to create (with texts informations, links and some special plugins).
  • I have a countdown timer app that requires the phone to stay awake during the entire sequence.

    I have the Browser object added, but I don't see any conditions/actions that will keep the phone active. Nor do I see any other object that would do the trick.

    Thank you for your help!

  • *bump from 2nd page*

  • Looks like you already found the only plugin supporting that..

    Not sure if it's still available and if and how good it works, but I guess you'll have to wait for an answer in the plugin thread, for I also can't find it in the link provided in the opening post..

  • Thank you, Yeah, nothing I have found has been helpful at all. Always leads to a dead-end.

    Ashley, do you have any sure-fire suggestions?

  • Is this in the browser or via Cordova or another platform?

    I think for Cordova there was a third party plugin that could do it. Browsers might keep the screen on if you enter fullscreen mode, but it might not, it's something web pages could easily abuse to waste device's battery.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you, Yeah, nothing I have found has been helpful at all. Always leads to a dead-end.

    Ashley, do you have any sure-fire suggestions?

    You can download the plugins here: https://shatter-box.com/downloads/cranb ... n-package/

    Use the "Phonegap Powermanagement" plugin.

    Install it, insert it in your project and add "On start of layout - Acquire"

    Docs: https://shatter-box.com/knowledgebase/p ... anagement/

    Note that cranberrygame (the plugin author) now only makes paid updates / support. The plugins in those package are the latest free available versions, so there might be newer (premium) versions. You can get the permium plugins here: https://plus.google.com/communities/117 ... 5005605917

    But the Power Management plugin works fine <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

  • Ashley - It's through Cordova. I'm using Intel XDK. I must admit that Cordova, Intel, Crosswalk...I know they're all related somehow, but I haven't fully grasped what's-what, so that's all I can say for sure. I'm exporting through Cordova and using Intel XDK to prepare the project for mobile.

    AndreasR - Thank you. I was looking at some of cranberrygame's stuff in other threads but couldn't find a viable option through that. I'll check out your links...

  • I got the Power_Management plugin...plugged in.

    But I do not understand the purpose of the Acquire or the Release actions.

    And none of the resources or links I have clarify this.

    Could you explain those to me, please?

    cranberrygame, perhaps you could clarify, please?

  • Hi,

    This is how it works.

    Acquire: Starts keeping the screen awake.

    Release: Stops keeping the screen awake.

    So trigger acquire on the start of the first layout. The screen will stay awake till you release it with "Release".

    Regards

    Andy

  • AndreasR - Thanks. I believe I already applied that but maybe I missed something. I'll double-check my work...

    Thank you for the details!

  • AndreasR - I put the Acquire action on the very first layout, triggered on Start of Layout event (in a sub-event checking for if it's on an Android or iOS mobile platform. I set my phone's screen timeout to 30 seconds, and even with the Acquire action in place, the phone still times out and goes to sleep.

  • AndreasR - I put the Acquire action on the very first layout, triggered on Start of Layout event (in a sub-event checking for if it's on an Android or iOS mobile platform. I set my phone's screen timeout to 30 seconds, and even with the Acquire action in place, the phone still times out and goes to sleep.

    I have the same problem on Android (Cordova -> Intel XDK -> Crosswalk). I haven't tested on iOS yet.

  • https://www.dropbox.com/s/5qb2yhy8tefbz ... .capx?dl=0

    There are only two event sheets in the program. No matter which "On Start of Layout" I utilize, it doesn't work.

  • You need to add the plugin to your Intel XDK Project

    Repo URL: https://github.com/cranberrygame/cordova-plugin-powermanagement[/code:2bw11en6]
    
    I updated the docs for that: [url=https://shatter-box.com/knowledgebase/phonegap-powermanagement/]https://shatter-box.com/knowledgebase/p ... anagement/[/url]
    
    Then it should work.
    
    Regards
  • AndreasR - I did that, and then I get this error:

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