How to control Notification group clicks - android

This question is about Android Grouped Notifications.
According to the official documentation, it mentions:
Note: If your app sends four or more notifications and does not specify a group, the system automatically groups them together on Android 7.0 and higher.
The problem is I found that this group of notification is clickable.
In my testing, I received a total of 5 notifications, 4 of them have their own pendingIntents, one of them is just a foreground service notification which is un-clickable and not dimiss-able.
While their clicking behavior worked correctly when separated, when I click on a group of them, Android simply creates on top of my current activity stack, another entrance Activity.
I know that I can force separate them into different notifications without grouping them, by specifying a different group ID for each of them;
Is there a way to preserve the notification group feature, but making the group non-clickable?

Actually, when a user clicks a group of notifications, you must open the screen where these "notifications" will be seen. For example, you are developing a social network app. You receive 3 notifications about new messages. You can group all of them as a "New message" and when a user clicks this type of group notification you must open the screen of the chat list. And if you receive 2 notifications about new friend requests, you can group them as a "Friend request" and when a user clicks to this group you must open a friend request list where all requests are shown.

Related

Is it possible to turn on and off different notifications for different things in one app? (iOS, Android)

For notifications for Android/iOS is it possible to turn on and off different notifications for different things in one app?
For example, we send notifications to the user using OneSignal service.
The first one if the user has not visited the application for a long time and another notification when there is a promotion in the store. So we have two different notifications.
Is it possible for the user to be able to turn off one of these notifications (manually in the app settings) and the other to work, or we can only turn off notifications completely?
Yes, they're called Notification Channels in Android. For every notification, you set a notification channel it belongs to. That way, the user can enable/disable specific channels.

Should these two be the same? NotificationChannel.setGroup and Notification.Builder.setGroup

While creating notification channels, I categorise them by assigning them to a group (NotificationChannel.setGroup).
Later, while displaying notification, I use Notification.Builder. Should the value given to setGroup method here be the same as the first to function properly?
Not necessarily. Even though they might be related in your business rules, channel groups and notification groups are used for different reasons.
As stated in https://developer.android.com/training/notify-user/channels:
If you'd like to further organize the appearance of your channels in the settings UI, you can create channel groups. This is a good idea when your app supports multiple user accounts (such as for work profiles), so you can create a notification channel group for each account. This way, users can easily identify and control multiple notification channels that have identical names.
So, if you set different channel groups they'll be displayed separately in App Info -> Notifications. I'd say you just need it if your app has multiple channels and you want to further organize them.
A notification group, the one you set in Notification.Builder.setGroup(), is used to group notifications in the notification tray. You can learn more about it at https://developer.android.com/training/notify-user/group.

How to Combine N Number of Related Android Push Notifications

I have been reading many posts/articles/tutorials I can find about updating an active notification. I fear I may have a fundamental misunderstanding about how one may update an Android push notification.
So far: I can update an active notification based on its ID, and I haven't been able to get any results out of Builder.setGroup()
My problem: When I update an active (not dismissed) notification, I want to be able to get the text from the previous, active notification, parse and add the new notification text and update it.
I'm starting to think that this might not be possible without a local DB and that my approach to this problem is no good.
Is there a way to get the content of the last notification (or one with a specific ID)?
EDIT: It seems to me that many of the examples I have seen are grouping a number of notifications all at once rather than successively.
Example
This is an example of what I want to do. The scenario I'm imagining is like this:
The owner of the device gets a notification that he/she has a new message from 'Alex Faaborg'. (See image)
The notification is not dismissed by the device owner
Another notification regarding a new message from 'Jeff Chang' comes in
Get 'Alex Faarborg's' name from the first notification, and 'Jeff Chang' from the second
Parse the info and display a summary of their notifications rather than have multiple notifications build up
4 is what I'd like to do
OK, so I realized I could do what I need to do to combine notifications by keeping track of users' unread messages(or invites etc..) on the backend, then if there's more than one, it will send out a summary of the notifications rather than each individually. On the client, this will overwrite any previous, related notifications (kept track with a JSON field sent to GCM (and subsequently, the client) that represents the 'topic' of the notification)
For whatever reason, I thought I should handle the grouping/summarizing of notifications on the client. I think the API is the way to go.

Pushing notifications at set interval based on the state of the shopping cart? /Ionic

We're building an ecommerce hybrid app (Ionic + Phonegap + Cordova) where users can put items in the shopping cart before buying them (similar to Amazon and other ecommerce services).
To encourage users to finish the purchase, we wanted to "scan" the shopping cart once per day and check if the user has some items in the shopping cart that have been there for more than 24 hrs.
They would then be notified daily at 3pm via push notifications if the algorithm finds any items that have been in the cart for more than 24 hrs. If there are no such items, no notifications will be sent. If there are multiple items, only 1 notification will be sent saying "I see you have 2 items in the cart you haven't bought yet. What are you waiting for?".
I am a non-technical member of the team and I have been told by the engineers that creating such notifications is not possible.
What I've been told, verbatim:
Unfortunately, due to the Apple and Android settings, code can't be
executed after the notification is shown. What that means is that we
can't check in the background for any outstanding items from the past
few days. The best thing we can do, is to plan a notification for the
next day if user has opened the application and there are items in the
cart. However, there is no way how to plan it for next X days.
The proposed solution is this:
When the user adds a new item, all scheduled notifications [as
mentioned above] will be deleted and new notifications will be
calculated (it gets difficult in this part because of grouping items
as we don't want to spam users with the notifications)
So my question is straightforward - is this a sensible solution and is there really nothing more efficient? Thank you.
There a two types of notifications:
Local Notification:
The notification is created in your app. One strategy can be:
Have an event handler for pausing and and another one for resuming of
the app.
If the app is going to pause, you calculate the notification text,
the date and time and maybe a badge. ( "You have two item in …",
shown in 24 hours.)
If the app resumes, you clear the notification(s).
You can create multiple notifications, but there is no useable way to make a recalculation, if the app is not in the foreground. For a short time you can have a background process, but it is not allowed to have this one for a longer time. (A special situation are GPS tracking and timer apps.)
Push Notifications:
This kind of notifications are send from notification providers like Google, Apple, …. Therefore you have to save the shopping data on your server and send a notification job to this providers, which delivers it then to the clients.
Push notifications are a bigger job to develop then the local once. The reason is, that you have to manage the shopping data, the devices and the communication with the notification servers. And you will have a lot of trash and fake data.
I would start with the local notification.,

Android - stay on notification list

I'm building an Android app which creates notifications. Each notification has a number of additional actions.
The default application (when the user taps on the notification) launches an activity in my app. That's working fine.
When the user swipes the notification to dismiss the notification, my app responds by doing some deletion work, and the user is left on the list of notifications. The one that the user swiped is removed from the list.
For some of my additional actions I want to launch activities, and that's working fine; for the other actions, I want my app to do some work but I also want the user to remain on the notification list. I'm struggling to find a way to do this last part - all my attempts to configure the intent and pending intent for my additional action result in behaviour whereby when the user clicks on the action, the notification list disappears.
Is there any way to get what I want (i.e. a notification additional action which performs work but leaves the user on the notification list)? Do I need to build a custom notification layout or something?

Categories

Resources