SankethBK / local_session_timeout

Redirect user to authentication page if the application doesn't receive any user interaction, or been running in the background for "x" duration.
https://pub.dev/packages/local_session_timeout
BSD 3-Clause "New" or "Revised" License
12 stars 19 forks source link

Events are not firing on Samsung S23 Android 14 device #30

Open sonisumit686 opened 7 months ago

sonisumit686 commented 7 months ago

I am using this useful package in one of my applications, working fine on range of devices though no events are getting fired on Samsung S23 devices (S23 max too) with Android 14 OSv. None is getting triggered, user inactivity or app focus.

The current implementation is having 4 mins of timeout trigger and targeted for Android and iOS. Checked on device OS level optimisations and power saving mode too but nothing down to that level is causing it.

One weird thing I noticed too, once we enable the logs (Flutter logs) or run a debug variant of build on same code base, it is triggering events, I can confirm there are no additional steps performed in release/signing stages other than ripping out the debug info. Any ideas on it would be helpful to get myself unblocked.

SankethBK commented 6 months ago

Hi @sonisumit686 I always wondered about this issue while developing this package but never faced it. I guess power saving mode is more stricter in some devices than other, ref.

One weird thing I noticed too, once we enable the logs (Flutter logs) or run a debug variant of build on same code base, it is triggering events, I can confirm there are no additional steps performed in release/signing stages other than ripping out the debug info.

My guess is a timer is not sufficient to prevent the device from hibernating the process, so i think when you enabled logs, a much heavier operation is being performed continuously which cannot be stopped by OS. We can use background tasks for better results, but I am not sure if it would be 100% reliable. Currently I can't think of anything else, I will update if I get anything.

sonisumit686 commented 6 months ago

Thanks much for getting back @SankethBK, I will too keep an eye on it and update here if come across any workaround or solutions.

SankethBK commented 3 months ago

Hi, i've fixed this issue in latest release 3.0.0. I have removed the timer completely which has risk of getting terminated from OS, instead storing the timestamp when app is pushed to the background and calculating the time difference when app regains focus.