Notification Timer should continue even if app is close without another notification - flutter

In my app there is condition where a notification is generated at button click and showing with Countdown it is working fine if app is open. With the help of background service notification timer also working fine even if app is close but I have to show extra notification for Background service in Android devices.
I am using flutter_local_notifications: ^9.2.0 and flutter_background_service: ^2.3.9
Is there any way to achieve my goal without background service and without extra notification.

Related

How to run timer even app in background or foreground in flutter?

i want to hide button for specific time when user tapped on button, and the button show when time is completed, even app in foreground or background
the ultimate solution is to use foreground services, and with android, it comes with a sticky notification to prevent the system from killing the app.

How to detect if Flutter webview is in foreground or background?

I have a requirement where I need to record the time user spends viewing a certain attachment. I am opening the item in an external webview provided by flutter_inappwebview package on pub.dev.
Now to detect the amount of time user is spending I run timers. I want these timers to stop when the app is not in foreground, so I used Flutter's lifecycle events to detect this. The problem is, as soon as the webview is opened, the lifecycle event paused is called. Now i don't know if the user is viewing the item or has pushed the app to background.
Any leads will be helpful thanks.
I tried using flutter's lifecycle events, but they fire as soon as webview is launched and does not fire any other events after the webview is opened until user comes back to the app.

How to make a determinate function when click in push notification meanwhile the app is running?

I'm trying to navigate to other screen when app is running. I only can navigate when app is on background or terminated.
Currently, I'm using FirebaseMessagin.instance.getInitialMessage() when app is terminated, and FirebaseMessagin.onMessageOpenedApp.listen() when app is in background.
I have tried to use both functions in FirebaseMessaging.onMessage() but nothing happens

Trigger an action when timer expires in the background

I’ve developed a Xcode app to trigger an action on timer expiry. This works fine when the app is visible on the device. However when the app is minimised eg. the Home button is pressed, the app doesn’t work. It seems like the app gets suspended. It resumes the countdown when it is brought to the foreground again.
Any guidance will be appreciated.
Timers will only run in the background if your app is running in the background for another reason. You will need to enable a background mode on the capabilities page. Your timer will also need to have already started when you enter the background
This may also be helpful:
https://www.raywenderlich.com/5817-background-modes-tutorial-getting-started

FCM Background handling in Flutter - iOS

What I want to achieve
I'm implementing FCM in flutter for iOS in such a way that in every state (foreground, background and terminated) when the notification is received, we need to show an alert with sound on the screen for some time (Say 2 mnts).
What is clear
Implementation is clear when the app is in foreground which can easily be done using onMessage callback.
Where is the issue
The confusion is with background and terminated part:
How to detect in the background that notification is received (I
know on Resume is called when we click on the notification in the
notification try). But we need to show alert on notification arrival
not on Clicking the notification.
How to detect when the app is terminated(I know onLaunch is called
when we click on the notification in the notification tray) But we
need to show alert on notification arrival not on Clicking the
notification.
Is it possible to show any system alert when the app is not running
like when notification is received while app is terminated and we
show a customized alert like Alarm alert on the screen.
There is onBackgroundMessage call back but I don't know if it works
for iOS (as documentation is more focused on Android settings in
onBackgroundMessage call back part).