Monday, 19 July 2021

How to make a background app open a dialog box every day at 2pm with Flutter?

I would like an app to open a dialog box every day at 2pm, even if the user is doing something else and is not currently in the app interface at this time.

How to do this with Flutter, such that it will work both on Android and iOS?

I was thinking about a method like this:

timer = Timer.periodic(Duration(seconds: 60), (Timer t) => checkTime());

that checks every minute if it's between 14:00:00 and 14:00:59, with a method similar to flutter run function every x amount of seconds, but this seems like a waste of resource: there is probably better, with a more natural way to wake up an app in the background at a precise timing?

Question: how to make an app display a dialog box at 2pm every day, even if the user is doing something else/is in another app, with Flutter?

Note: if the device has its screen off (i.e. user is not using their phone), the dialog box should be displayed the next time the screen is turned on.



from How to make a background app open a dialog box every day at 2pm with Flutter?

No comments:

Post a Comment