Get all notification messages (if any) when the app is opened using app icon - flutter

I was working with flutter and I managed to implement FCM push notification in the app. The FLUTTER_NOTIFICATION_CLICK click_action works fine.
But, I need to perform that similar action when the app is launched by clicking the app icon. Is there any method to do so?
Ultimate goal is to perform similar action when the app is launched by clicking the notification or by the app icon (from the app drawer). Please help me with this.

As far as I know, there is no way to get the received notification content when the app is opened using app icon in Flutter. I tried to find a method, but as of now, I am at zero.
Flutter with FCM supports only onLaunch and onResume click_action events for notifications. If you are able to write some native code, I think you may be able to do this. A simple work around I can give is that :
You can clear the notifications as soon as the app is opened using NotificationManager in Android. Here is the reference.
After that you can fetch the actual notification messages from your server(if there is one) and show it to the user.
This is not an accurate answer. But this is what I finally did. Not sure if this helps.

If you click and launch from notification
You can listen that 'onLaunch' method in firebaseMessaging.configure
But from 'app icon' is no way as far as I know.

Related

Android Notification Not clickable in Unity

We are facing a problem in unity is, when clicked on the scheduled notification in android. The app does not open.
We have firebase messaging in the app so it uses the activity "com.google.firebase.MessagingUnityPlayerActivity".
When a scheduled notification appears and we click on them its try to open "com.unityplayer.UnityActivity" instead of "com.google.firebase.MessagingUnityPlayerActivity" maybe this is causing the app not to open.
But, when scheduled notification appears when the app is already open and we kill the app and click on the notification it perfectly try to open activity "com.google.firebase.MessagingUnityPlayerActivity" and application also opens perfectly.
Do any of you have an idea on how to work around this or a way to fix this. or is this a issue from Firebase sdk itself. Please share you ideas.
Unity 2020.3.41f1
Firebase Cloud Messaging : 10.0.1
I Have tried changing the activity name from Mobile Notification but it did not work.

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.

An alert like whatsapp when app is in background in ionic

I am using One Signal push notifications in my ionic app. I want to show an alert when i receive a notification when my app is in background.
I tried using the platform pause and remuse functionality to check for background and foreground and then generate an alert when app was in background using ionic alert controller but was not able to produce the desired result.
I want a pop up dialog box like one in whastapp when u receive a message.
Can anyone please suggest a solution to this.
There is no way to achieve what you're trying to achieve through the use of OneSignal alone. The OneSignal plugin for Ionic has two calls to action:
handleNotificationReceived() & handleNotificationOpened()
The first one is called when the notification is received and the app is in the foreground.
And the second is called when the app is launched from the notification.
You would need some other service to record when notifications are sent to see if there were any when the app was launched by itself. If you use OneSignal's REST API to send notifications yourself, you can record when a notification is sent, and then when the app is launched by itself, you can fetch missed notifications or notification count from your own server. That's just one way you can do it.
But OneSignal is a push notification service, which send notifications. Even if you did FCM yourself and went through the scenario you mentioned, the results would be the same.
It's not a OneSignal issue. It's the way notifications are designed.

phonegap ios) is it possible distinguish push notification that user clicked?

I am using phonegap push notification plugin and all seems work fine. push comes without any problem.
But the problem is there is nothing I can do when app is back-grounded.
multiple push notifications can arrive when app is backgrounded. I can not expect which push
notification user going to click. Whatever notification user clicks, app will be resumed without
information of user selection. I have to trigger different events depanding on what nofitication
user selected. I need to know what notification user selected when app is resumed but don't
know how to... seems very tricky problem. is there anybody had same problem?
how did you guys handle this problem?
any help will be appriciated.
never mind...
I thought window.plugins.pushNotifiction.getPendingNotification would return all pending
notifications which arrived while app is background.
But getPendingNotification function only returns the notification that user selected on
notification center or mobile screen.
well... seems nice..
you can`t get all notification information which fire during application is off or app. is in background but, you can fetch user info shortly receive notification in native iOS app.
please follow this application:didFinishLaunchingWithOptions.
At first call of launch you can check for options and retrive the user-info.
for more info refer above link.

iphone programming adivce

Hello I was wondering if there are any methods that would allow me to interact with the iphone users. What I mean is like UIALERTVIEW of some sorts that will popup and update them with a status. But I don't want to have a fixed status, but one I can change anytime I want, like say if there is a day off, I want to provide a status over the air and when the user opens the app it will show the new message.
Is this even possible?
If there are any other alternatives please list them
The easiest solution would be that your app is contacting your website and downloads any message it should show on startup.
You can use Push Notifications to send users important updates automatically.
What you are looking for are called Push Notifications. They can put small numbers on your app's icon like the email app when you have new emails, or even show you popups when you need it. Start here: https://developer.apple.com/appstore/push-notifications/index.html
you can use Push notifications .. or build your own notification system by design a function fired when your application launching to contact your website and check if there any new notification .. then you present a pop , view whatever to show the notification.