Android Question NB6 group notifications

Alexander Stolte

Well-Known Member
Licensed User
i added this 2 subs to the nb6:
B4X:
Public Sub SetGroup (groupname As String) As NB6
'    If IsBuilder Then
        NotificationBuilder.RunMethod("setGroup", Array(groupname))
    'End If
    Return Me
End Sub

Public Sub SetGroupSummary (summary As Boolean) As NB6
'    If IsBuilder Then
        NotificationBuilder.RunMethod("setGroupSummary", Array(summary))
'    End If
    Return Me
End Sub
and follow the tutorial on the android page:
B4X:
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(smiley)
    
    n.SetGroup("b4a.example3nb6.TEST_GROUP")
    n.SetGroupSummary(True)
    n.Build("Title", "Content", "tag1", Me).Notify(Rnd(1,1000))
but the notification is still not grouped
 

DonManfred

Expert
Licensed User
Please see this answer from SO
Right. I find the API confusing: NotificationCompatBuilder.setGroup() method comes from the Wearable API. Its purpose is to manage notification groups on the wearable - though it also affects the phone. But most people are looking for the Gmail-Whastapp-like groups on the phone. Answer is : you have to do it yourself using notificationIDs to update your notifications. And you have to save your data between each notifications, to be able to compute the "summary" notification - which is, again, up to you to build and to send with the same ID to replace the previous "non-summary" notification. – John May 4 '16 at 16:22
 
Top