restrict notification for flutter - flutter

I want restrict all types of notifications (WhatsApp, Instagram, Facebook, etc.)when specific page in flutter app is opened. how can I achieve it ? is there any package available ?
Its like a game mode when the app is opened user will not get disturbed by any other app notification

You can use this package
Flutter Dnd
and when that page is opened, activate dnd
and when that page is collapsed turn it back to previous state (Store the previous state before setting a new state).
You can get current state using getCurrentInterruptionFilter function.
But as of now it only supports Android.

Related

How to check if my Flutter Web app is currently running?

I am building a chat app in Flutter Web, and would like to add a feature for flagging when the user is "Online".
I want to send a bool to Firebase Firestore whenever the user launches and closes the app (for example, when the user launches the Flutter Web URL = true is being sent to Firestore for isOnline flag. And when the user closes the tap = false is being sent to isOnline).
For that, I would need a way to detect the lifecycle of the Flutter Web app, and to check whether the app is currently actively running or not.
Does anyone know what is the best way of doing that?
Thank you!
While you can easily update your firestore whenever a user opens your app (just add it to a point executed on launch, like before the runApp() part in your main method). However, there sadly is no guaranteed way to know, if a user closes your app. It could be force closed via task manager etc., robbing you of the ability to detect it. However, firebase offers the following solution to detect presence, see here.
You could also save a timestamp as the isOnline point and let it timeout. You could update it periodically in your app, giving you not a perfect but maybe a good enough idea if a user is online.

How to make push notifications target a flutter app?

Using firebase web, I want to trigger a notification in a flutter app from a dashboard. In other words, I want to target the flutter app whenever I make certain changes in the dashboard using firebase cloud messaging.
Can I do that? Or do I have to write separate codes in both the flutter app and the web app?
when you trigger a notification in a flutter app from a dashboard. You can choose which app to push (Android/iOs/web)
Just to add more on Vu Thanh's answer, you can use the User Segment in the Messaging console to select the Flutter app you want to send notifications to. You can read about a related post here.

How to execute actionStream on a notification when application is in terminated state with awesome_notifications in flutter?

I have a flutter application that receives FCM Data messages.
On each data message, I create a respective notification locally using the awesome_notifications library. I have 2 action buttons on the notification. The action button click navigates me to a specific page when the application is in the foreground or background(paused).
But, the same click action doesn't work when the app is terminated/killed. Instead of navigating to some page, it just opens the application's homepage.
I'm listening to actionStream, but it seems it doesn't work when the app is terminated.
If anyone has a solution to this, it would be beneficial!

Can a flutter app run code on receiving a push notification while Not Running

I have push notifications working and have both a data and notification part in them. In the data part is a tag that tells the app what updates are available for the user.
The problem is that I would like the app to fetch those updates even if the user does not tap on the notification.
With other apps, eg Whatsapp, a notification is shown. Without tapping this notification, and even when the app is not running, the app downloads the data. For example if the user switches to flight mode right after receiving the notification and then opens whatsapp, the message and/or picture is there, already downloaded and displayed in the app.
So the question is how to get an app written in Flutter to download something in response to getting a push notification, regardless of whether the app is in the foreground, background, or not running.
Checkout isolate mentioned in Flutter background processes with a link to Medium Executing Dart in the Background with Flutter Plugins and Geofencing
Checking with GitHub issue Flutter should provide an abstraction for background execution and issue comments/references after that you may find some other examples. Bottom line is people need more examples.

Popup notification to be displayed in mobile

I am using Ionic 1 framework for mobile apps. I want my push notifications to be displayed as popups like truecaller even app is remains closed . What are the plugins that may get used?
Check out OneSignal. It's 100% free and developer-friendly to use on multi-platforms.
OneSignal provides a simple interface to push notifications and email, letting content creators focus on quality user engagement instead of complex implementation
https://documentation.onesignal.com/docs/ionic-sdk-setup