idlejs icon indicating copy to clipboard operation
idlejs copied to clipboard

Working Fine in Desktop , but not in Mobile Devices

Open amul8612 opened this issue 4 years ago • 1 comments

i tried to check the idle timer in my webapp , it is working in Desktop but when i try to access the same in the mobile devices , the idle timer is not working . Steps: Log in to my web App in my mobile (Chrome Browser) Push it to Background app Lock my mobile device Come back after 15 mins to check , if i see a modal about User Inactive. Result: I could not see any dialog box. Is the timer is working ?.. Can u please help me

Here is my Code To check the Idle Timer : const TouchDeviceIdle = new Idle() .whenNot([ { events: ['touchcancel','touchmove','touchstart','focus','focusin'], target: document, }, ]) .whenNotInteractive() .within(15) .do(() => { if(this.sessionModalShow){ TouchDeviceIdle.stop(); }else{ this.userInactive(TouchDeviceIdle); } }) .start(); */

amul8612 avatar May 30 '20 15:05 amul8612

@amul8612 That's probably because mobile OSes are pretty restrictive about which apps can work on the background, and what they can do.

So it's likely that mobile browser doesn't keep executing the webpage's code, when the app is on the background for various reasons, (obvious one is that it could drain the battery)

Although this can be worked around by saving the time before the mobile browser tab becomes inactive and checking how much time was spent inactive once the tab becomes active, I don't have time right now to dig into it and handle this specific case.

harunurhan avatar Jun 01 '20 15:06 harunurhan