Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter timer issue when screen is locked #148

Closed
shuzuka12 opened this issue Aug 4, 2018 · 2 comments
Closed

Flutter timer issue when screen is locked #148

shuzuka12 opened this issue Aug 4, 2018 · 2 comments

Comments

@shuzuka12
Copy link

I am working on session time out. when app is in background state timer is working fine and after time expires it will redirect to home screen. but when i lock the screen timer is taking more time beyond the actual time. it giving time difference when screen is locked and unlocked.

For time count used Timer.periodic() constructor.

Can anyone help me on this issue.

@lejard-h
Copy link
Collaborator

lejard-h commented Aug 5, 2018

probably due to flutter engine, I guess the process is stoped when the phone is locked.

But you can try to use a timestamp and get the time elapsed when the app is resume using WidgetsBindingObserver

https://docs.flutter.io/flutter/widgets/WidgetsBindingObserver-class.html

@lejard-h
Copy link
Collaborator

lejard-h commented Aug 5, 2018

I will close the issue since it is not related to the webview plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants