Access notification log data - android

I wanted to know how can I access the data which comes with our notification in notification log. Like I just want to know which app sent the notification, if the user opened that notification or not and when the notification arrived. I want to use these data in my app to process these data items and display it on my android app.
Please help.

Related

notification click event, best way to show activity data from service while app is closed android

i have made an app where i made a unbound service that is continuously requesting to server api, if server send json then notification will show and on notification click i take the user to one activity to show some data. everything working well while apps is opened or background. but when the app is closed, notification showing but when on notification click trigger to specific activity, there is no data showing(data should come through a server req).
what is the best way to do this?

Unity3D - Retrieve Firebase message data after user dismisses the notification

I've managed to retrieve the data when the app is in foreground and when the app is in the background and the user tap the notification. The problem happens when the user dismiss the notification, the FirebaseMessaging.MessageReceived callback never got called.
Is there a way to retrieve/retain the notification data when the user dismissed the Firebase notification?
It appears that this behaviour is specific to messages that contains both notification and data payload. If you want to receive the data packet no matter what, send it as pure data package.
In this case, I simply split the message into two, one containing the notification and the other containing the data, and then send them via the Fcm HTTP endpoint separately.

Get data payload of android notification on dismiss

I'm using Firebase Cloud Messaging to send notifications with data payload to my app.
When i send a notification, if my app is running (foreground) i get the data overriding the onMessageReceived() from FirebaseMessagingService class.
If my app is not running the notification is sent to the "system tray" and when the user click's in notification my app start and i can get the data with the getExtras of the intent.
But, how could i get the data if the user dismiss the notification in "system tray"?
I need to write some background service that "listen" to the notifications to get this?
Seems like you are sending notifications from the Firebase console. These messages are always notification messages. If a notification message has an accompanying data payload then that data is only available to your application if the user taps the notification. If the user never taps the notification then that data will not be available to your app. So you should not use notification messages to send app critical data to your application.
If you send data messages they are always handled by onMessageReceived callback. At that point you can either silently handle the message or display your own notification. So use data messages if you want to be sure that your application has an opportunity to handle the data in the message.
So basically you want to store that data ?
if you want to store that data then write your code in OnReceive() method and write Database insertion code in it.
and put one flag in it like "Dismissed=true"
and if user open your notification then make it false and you can get your result.
There is no specific method to detect whether your app's notification is dismissed or not. So you have to manually maintain that data.

How do I get a call back for notification received in android?

Is it possible/is there a reliable way to get a call back when a notification is received on the android platform? i.e. I want to record when the notification is received (not when it is later opened).
No, It's your app which receives the message so if you need things logged, then log it. Simply handle it as you like once you receive it. Note that if you use FCM with Notification message message type, then you will not be directly notified about message arrival when app is in background (notification will be automatically posted by Firebase - your app will get message payload once use taps the notification). In such case consider switching to Data messages so you will get it no matter your app is in foreground or not.
See docs: https://firebase.google.com/docs/cloud-messaging/downstream

Showing notification from server directly in app

Android push notification show notification in title bar.But i want notification to be directly shown in the app if the app is opened.For example in driving apps when customer request for cabs, notification is directly shown in the driver app which is opened.Driver don't need to refresh the app or click on any link.How can i do that?Should i use push notification only?
Its upto you how you want to use the data you get from the GCM.In a typical case you get the data from the GCM server which invoke your Broadcast receiver and which starts the service where you parse the data and then create a notification and show it.If you don't want to create a notification just parse the data and populate the view and show it wherever you want in the current activity or somewhere else.Its entirely upto you how you want to implement it,there are many ways to implement it

Categories

Resources