Can i call the bottom notification without StartForeground? Will it cause any issue with late android version? It seems to be working ok with Android 7. Android 8+ requires channels. Is the importance_low considered as channels?
B4X:
Dim n As Notification = CreateNotification(WhatMessage)
n.Notify(1)
Sub CreateNotification (Body As String) As Notification
Dim notification As Notification
notification.Initialize2(notification.IMPORTANCE_LOW)
notification.Sound = False
notification.Vibrate = False
notification.Icon = "icon"
notification.SetInfo("Status", Body, Starter.WhatFormName) 'can't use main. unless last known activity then it will be ok
Return notification
End Sub
I was hoping i can use Service.StartForeground(1, CreateNotification("...")) with NB6 but unfortunately it can't work. My service uses Service.StartForeground(1, CreateNotification("...")) which is not removable and i wanted to add a button to it. I do not want to create a new channel which i am sure its doable with NB6. I want to keep it at 1 channel only.
Or can i update the Service.StartForeground(1, CreateNotification("...")) channel with NB6 which contains buttons? I need to try that.
Sub CreateNotification (Body As String) As Notification
Dim notification As Notification
notification.Initialize2(notification.IMPORTANCE_LOW)
notification.Sound = False
notification.Vibrate = False
notification.Light = False
notification.Icon = "icon"
notification.SetInfo("Status", Body, Starter.WhatFormName)
Return notification
End Sub
Then the Channel 1 gets updated by this. I can override that channel with NB6 instead of Internal Notification.
B4X:
Sub BigText_Notification2(Body As String, Body2 As String)
'the behavior will not be same if channels is changed or setdefaults
Dim n As NB6
n.Initialize(1, Application.LabelName, "LOW").SmallIcon(TripIcon2).AutoCancel(True)
n.SetDefaults(False, False ,False)
n.BigTextStyle("Status", "", Body2)
n.Build("Status", Body, "tag2", Starter.WhatFormName).Notify(1)
End Sub
It seems to be working OK.
After reading the above statements, same here i do not understand what i was saying, i get off subject sometimes. But i found what i was looking for in the above codes.