skip to Main Content

I want to implement Timer in flutter that is capable of running in background despite when the phone is locked. I have tried Timer.periodic and isolates but both of them do not run in background or when the phone is locked. And also I also came across the logic of saving the timestamp when going to background and comparing that same time while coming to foreground, but that is not feasible in my case. So Anything else do you know apart from these would be helpful.

2

Answers


  1. Store the value in cache when you start your timer and when you stop your timer, you differentiate between now and the value you stored in cache.

    Login or Signup to reply.
  2. You can try packages like flutter_background_service or android_alarm_manager_plus i guess these would help

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search