Android Question NB6 Notification as persistant

jazzzzzzz

Active Member
Licensed User
Longtime User
Code: Copy
Dim n As Notification
                n.Initialize
                n.Icon = "icon"
                n.Vibrate = False
                n.Sound = False
                n.Light = False
                n.SetInfo("test", "Nothing to show",Main)
                Service.StartForeground(0,n)

I need to make a NB6 notification which continuously change its content in every 3 seconds and is persistent like in above code..Any help?
 
Just select the nb6 notification that you want to use and restart the service every 3 seconds using StartServiceAtExact or you could try to keep the service alive with a partial lock and service foreground for sdk 26+.

Search the forum for 'service foreground'
 
Upvote 0
Just select the nb6 notification that you want to use and restart the service every 3 seconds using StartServiceAtExact or you could try to keep the service alive with a partial lock and service foreground for sdk 26+.

Search the forum for 'service foreground'

still people can swipe and remove the notification right?

I have seen some speed monitor apps which keeps on changing data with non removable notification..! I need a non removable b4a bridge notification with some live data change like time.!!
 
Upvote 0
Hello,

i needed the same, and worked it out!

add this to your NB6:

Code: Copy
'Sets the ongoing status of the notification, the user cannot close it.
Public Sub setOngoing (ongoing As Boolean) As NB6
    If IsOld Then
        OldNotification.OnGoingEvent = ongoing
    Else
        NotificationBuilder.RunMethod("setOngoing", Array(ongoing))
    End If
    Return Me
End Sub


And where you setup the notification add:
Code: Copy
n.setOngoing(True)
 
Upvote 0

Similar Threads

Back
Top