EddyVerbruggen / Insomnia-PhoneGap-Plugin

:sleepy: Prevent the screen of the mobile device from falling asleep

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Verifying behavior (update docs?)

toddmedema opened this issue · comments

Did a quick test on my Android device (no iOS device handy), and it seems like the behavior is:

  • call keepAwake
  • device screen stays on forever as long as app is open (with noted bugs re: camera)
  • if the app is minimized, the device resumes normal screen timeout
  • if the app is re-opened, the screen resumes staying on forever

(basically, I wasn't sure if I'd have to manually listen for app pauses and starts to re-call allowSleep + keepAwake)

If this is the behavior on all devices, would be great to mention it in the docs :)

Thanks for starting that piece of doc 👍

Would be cool if others can chip in and test those cases. Then we can decide what the expected behaviour should be.

I'd say a pause-resume cycle should trigger keepAwake if that's what was active when the app was paused.

Just confirmed on an ipod touch, looks like it has the same behavior

Nice, thanks. What would you expect to be the default behavior? I'm leaning towards having the plugin handle pauze/resume and restoring keepAwake if necessary. But I may opt for documenting this quirk in the readme as well because I don't currently have time to change it..

@EddyVerbruggen that's what the default behavior seems to be, and that's also what I'd expect (and hope for), that the app persists your awake / sleep flag when open, but doesn't mess with the user's system settings when closed / paused

Nice, then it's merely a matter of adding this to the readme as you initially mentioned, right?

Would be great for someone to test it on a Windows Phone, since the plugin says it supports that - if that passes, then yea, all we'd need to do is update section 1 of the readme to clarify that device never fall asleep -> while the app is open, persists across the app being paused and resumed