EddyVerbruggen / Insomnia-PhoneGap-Plugin

:sleepy: Prevent the screen of the mobile device from falling asleep
264 stars 106 forks source link

Verifying behavior (update docs?) #34

Open toddmedema opened 7 years ago

toddmedema commented 7 years ago

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

(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 :)

EddyVerbruggen commented 7 years ago

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.

toddmedema commented 7 years ago

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

EddyVerbruggen commented 7 years ago

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..

toddmedema commented 7 years ago

@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

EddyVerbruggen commented 7 years ago

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

toddmedema commented 7 years ago

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