Identify Flutter App has been open by clicking on the App Icon - android

Is there any way in flutter to identify if the App has been opened by clicking on the App Icon or by some other options like Push Notification or deep linking.
If there is a way to identify the App has been opened by clicking on the App Icon I can deal with the other cases.
I tried to play with WidgetsBindingObserver but all it could give me is the state of the application or it is possible that somehow I'm missing some obvious part!!
N.B -- I'm not using Firebase Messaging.

For Flutter push notifications through firebase, you can use the following callbacks to check if the app is opened through push notification
onMessage: if the app is currently running (foreground) it will return you a stream of remote messages
onMessageOpenedApp: When the app is in background mode and the user has opened it using push notification, it will return you again stream of remote messages
Note: it will not work if the app is terminated or not running for the following method is used
FirebaseMessaging.instance.getInitialMessage(): it will work if the app is opened through push notification when it was in termination state, return a remote message not a stream of messages
Hope this will be helpful
Thanks

Related

how to open a app when its in quit state while receiving fcm push notification - REACT NATIVE

Planning to build an app like uber we have two apps one for end users other for drivers, if end users send a booking notification we need to display in driver app push notification as 'cancel' and 'accept' button with sound like ringtone or we need to open the app automatically, if the app is in quit state or background state. Technologies used: - react native, firebase. Please help me to resolve and am eagerly waiting for your valuable suggestions and ideas
https://0x1bitcrack3r.medium.com/incoming-call-notifications-for-react-native-apps-ef4725702401 - using this blog i can able to change the push notification ui and able to trigger ringtone like whats app call
i would suggest you to go for https://rnfirebase.io/ using this you can have an node app or use firebase function to push notification to the device which is registered
here you would use the following
onNotificationOpenedApp
:
When the user presses a notification displayed via FCM, this listener will be called if the app has opened from a background state.https://rnfirebase.io/reference/messaging
onNotificationOpenedApp(listener: (message: RemoteMessage) => any): () => void;

Push notification not coming in IOS device when app in background or kill. Navigate to next screen also not working In IOS device in Flutter?

Push notification not coming in IOS device when app in background or destroy.
Navigate to another screen is also not working in IOS device. All things are working properly in Android device
Here is My Code::-Main.dart
https://gist.github.com/phenomenal25/87f5e9a8564b834129033c1e6e513a17
Hi guys i found the answer of this
Push Notification comes only (in IOS device) when your app in background or terminated the system tray will not give the notification when you passing custom data on this. Message is stored by FCM and delivered to app via onMessage when the app is brought back to foreground.
Check out your info.plist, the below code is added or not.
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
Note: Test in the real device, not in the simulator.

Get push notification payload when opening app, Android Titanium Appcelerator

I have activated push notifications in my application and I have done all the settings with Google and Apple to be able to send from the Appcelerator Dashboard.
I can receive notifications on both Android and iOS without any problems.
In iOS, when i click the notification from the notification center, the application opens and the callback function of Ti.Network.registerForPushNotifications is executed automatically.
The problem is that in Android, the function assigned to the callback event of the cloudPush module is not executed, I understand that it will be because when opening the application the listener is not yet created.
If I receive the notification when the application is open the callback function runs smoothly.
Reading in documentation of Android seems to me to understand that the notification is included in the extras of the intent when opening the application, but I am not clear what extra is, since in Appcelerator I do not find any function to obtain all the extras.
Someone could give me an idea of ​​how to get the payload, whether or not when I click the notification the app is in the background, as if it is totally closed?
Thanks in advance.

Google Firebase Notifications for Android - when app is not running

I am trying to implement a functionality wherein users get notification messages even when the app is not running (neither in foreground nor in background). Companies like Amazon do send notifications and they show up in the notification tray - when tapped, the app opens or whatever intent the message carried with it.
I have been able to implement notification handling when the app is in foreground and background... but when the app is not running, there are no notification messages received at all!
From what I searched around, I think there needs to be a Service running in the background that keeps listening to notification messages - because a service is destroyed when the app is closed. Am I going in the right direction?
Can someone point me to some code that implements or highlights the same.
FIXED... actually.. the problem was MIUI.. Its security app by default disabled autostart for apps.. which blocks notifications from being shown in the system tray when the app is not running.
References:-
http://en.miui.com/thread-37783-1-1.html
https://github.com/firebase/quickstart-android/issues/89#issuecomment-233558184
I you have to see the implementation of FCM for android from https://firebase.google.com/docs/cloud-messaging/
I shows complete understanding of instant notification.

Air iOS/Android push notification remember when app launches

I have an app built for iOS and Android which has push notifications. Everything is working great however I was wondering if there is a way to store the data of the push notification in the app so that when users launch the app after receiving a notification I can show them the message again?
Basically I allow users to share information and/or chat amongst their friends. If they receive a notification when the app is in the background it comes through as a normal push message but when they launch the app I would like to direct them to the chat feature to see the message again.
I am storing the messages sent in a remote DB but seeing as they have already received the payload it doesn't make much sense for the app to call the remote DB to retrieve the same message.
I am using Distriqt's extensions in AS3 and Air 3.5.
Cheers
I asked Distriqt's support for the same thing a few weeks ago and they explained that there is no way to get the information of the push notification message while the app is closed so they suggested this :
- when the user opens the app, you call your server to check if they haven't missed anything, and get the data from there. If there has been a push, you display the push message as if it was received with the app in the foreground.
It's a bit tricky and not very satisfying but it works.. As long as the user follows the path.
If your user receives the push and chooses not to open your app, he will still get the push message in your app next time he opens it.
I was having trouble figuring this out too but I found a solution! Basically if a user launches an app (not running in the background) by way of a notification it comes through in the Invoke event, not the usual Notification event. So do this:
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, invoked);
private function invoked(evt:InvokeEvent):void
{
if (evt.reason == InvokeEventReason.NOTIFICATION)
{
var payload:Object = Object(evt.arguments[0]);
// do stuff
}
}
That's pretty much it. There's more detail in this blog post here: http://blogs.adobe.com/airodynamics/2012/05/29/push-notifications-support-in-ios/
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, invoked);
doesn't work correctly for Android push notification. Android starts with InvokeEventReason.standard all the time, so we cant receive message. It works only for iOS.

Categories

Resources