Coder Social home page Coder Social logo

Comments (10)

SankethBK avatar SankethBK commented on September 28, 2024 1

Hi, I think the issue is because when you re-open the app inactive state is emitted which overwrites the previous value of _appLostFocusTimestamp. I have raised a fix, can you checkout to this branch and try once. If it works I'll merge the PR and create a new release

from local_session_timeout.

SankethBK avatar SankethBK commented on September 28, 2024 1

Great! I'll create a new release with this fix

from local_session_timeout.

Erchil66 avatar Erchil66 commented on September 28, 2024

I solve mine by adding a package called wakelock_plus, In this case we know that the app is still in foreground even the though it's on screen.

e.g.

When app is inactive call the WakeLockPlus.enable();
When app is resumed call the WakeLockPlus.disable()

I hope this finds you helpful.

from local_session_timeout.

SankethBK avatar SankethBK commented on September 28, 2024

Hi @guperini , Android kills background processes for power saving ref.

Thanks for the input @Erchil66 , I'll go through the package and see if same can be used here

from local_session_timeout.

SankethBK avatar SankethBK commented on September 28, 2024

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.

from local_session_timeout.

klaokamol avatar klaokamol commented on September 28, 2024

Hi, In my case when app in minimize (background -> foreground) invalidateSessionForAppLostFocus is work in first time but next time when minimize again it not work. I am not sure is cause from time stamp in status inactive set new time. thank you.

minimize (foreground -> background)

flutter: state AppLifecycleState.inactive
flutter: state AppLifecycleState.hidden
flutter: state AppLifecycleState.paused

open app again (background -> foreground)

flutter: state AppLifecycleState.hidden
flutter: state AppLifecycleState.inactive
flutter: state AppLifecycleState.resumed

from local_session_timeout.

SankethBK avatar SankethBK commented on September 28, 2024

Hi @klaokamol I'll check this

from local_session_timeout.

SankethBK avatar SankethBK commented on September 28, 2024

@klaokamol Its working fine for me, can you check if the same issue is occurring in the example app? You can disable invalidateSessionForUserInactivity by passing null so that it won't interrupt.

from local_session_timeout.

klaokamol avatar klaokamol commented on September 28, 2024

Thank you for reply, I'm testing by use same code like exmaple: Sample Usage and rollback to old version is work fine.
my invalidateSessionForUserInactivity duration set to 1 second

test step:

  1. run app first minimize app and open app again
    (invalidateSessionForAppLostFocus is work in first time and timeoutEvent == SessionTimeoutState.appFocusTimeout)

  2. minimize app (foreground -> background)

flutter: state AppLifecycleState.inactive -> lib stamp time 00:01:30.00
flutter: state AppLifecycleState.hidden
flutter: state AppLifecycleState.paused
  1. open app again (background -> foreground)
flutter: state AppLifecycleState.hidden
flutter: state AppLifecycleState.inactive -> lib stamp time 00:01:31.00
flutter: state AppLifecycleState.resumed -> check dif time ( 00:01:31.00 and 00:01:30.02) < 1s

difference time in SessionTimeoutManager function didChangeAppLifecycleState is always false because it's double stamp time. and sessionConfig.stream.listen((SessionTimeoutState timeoutEvent) not call back.

from local_session_timeout.

klaokamol avatar klaokamol commented on September 28, 2024

@SankethBK I tested it and it worked. Thanks for your help. 🙇

from local_session_timeout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.