How to differentiate the screen on which users interact with push notifications - android

I am curious to know the screen on which a user interacts with a push notification. Currently this can be the lock screen, the notification tray, or the app badge. Is there a way that can help me tell what screen the user interacted with a notification?

There is no direct way to tell which screen a user interacted with when they received a push notification. The notification handling logic in your app is triggered the same way whether a user interacts with a push notification on the lock screen, the notification tray, or the app badge.

Related

Android app to show push notification on lock screen or notification drawer when receiving it on foreground

Anyone knows how to show push notification on
lock screen or notification drawer when Android app receives the notification on foreground?
I'd like to implement the function without using local notificatin.
In case of iOS app, you can use the following method when receiving notification on foreground.
completion([.list])
in
userNotificationCenter(_:willPresent:withCompletionHandler:)
Then you can show the notification in Notification Center
https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649518-usernotificationcenter
I'd appreciate it if you tell me how to achieve the UX.
Than you.

Notifications in app only, not in notification center

is it possible to have notifications pop up, make a sound and be shortly visible at the top of the screen but not be logged via the notification center?
My idea is to have the user be notified of any important actions. But while the user is inside the app the notifications should not pool up inside the notification center. When the user is not actively using the app I will start a background service with a websocket and get further notifications for the user to be shown via the notification center.
So it it possible to differentiate between the two types. Similar to what whatsapp is doing?
One way to achieve the desired effect seems to be to just cancel the notification by ID once it has been passed to the notification manager:
https://developer.android.com/reference/android/app/NotificationManager#cancel(int)

How to show full screen notification when receives Firebase push notification and app is closed and phone is "sleeping"/with screen off?

I need to show some important notifications that are time sensitive and need to wake up the android phone and show full screen intent notification even if phone is "sleeping" when receive an Firebase notification. How can i do that?
Thank you.

How the android application knows when the heads up notification disappears?

We need to display the heads up notification when our application receives a notification and application is running in foreground. If application receives any other notifications while the current notification is in display, we need to queue the notifications, pop it from the queue and display it when the current notification disappears. Since the heads up notification automatically disappears from screen (remains visible in the notification drawer), I am not sure how our application knows when the heads up notification disappears from screen. Is there any event our application receives? Can any one please let me know if there is any mechanism to know when the heads up notification disappears?

FCM: I have used FCM to receive notification for my app. When my app is in foreground it groups all notifications but not when app is in background

I am able to group notifications for my app when it is in foreground. Whenever the app goes in background it creates multiple notification. How can I fix this?
As google says in this site, when app is in background notifications are administrated by the system by default :
Notifications delivered when your app is in the background. In this
case, the notification is delivered to the device’s system tray. A
user tap on a notification opens the app launcher by default.
But if you want to work with the notifications by "yourself" you should send the 'data message' instead of the 'notification' as is said here and you can handle the notification.

Categories

Resources