i use this code for show a notification:
But OnGoingEvent = false is not working
such OnGoingEvent=true not worked
i use b4a version 9.01 and sdk 28
this not work in any device
i want my notification erasable and user can close this
help
what do i do?
B4X:
Dim ntf As NotificationBuilder
Dim bv As Notification
ntf.Initialize
ntf.SmallIcon = "icon"
ntf.Ticker = "test"
ntf.DefaultLight = True
ntf.DefaultVibrate = True
Dim Sound As Boolean = True
ntf.DefaultSound = Sound
ntf.ContentTitle = "app"
ntf.ContentText = "test"
ntf.SubText = "Text"
ntf.setActivity(chat)
ntf.AutoCancel=True
ntf.OnGoingEvent=False
Dim p As Phone
If p.SdkVersion >= 26 Then
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim manager As JavaObject
manager.InitializeStatic("android.app.NotificationManager")
Dim Channel As JavaObject
Dim importance As String
If Sound Then importance = "IMPORTANCE_DEFAULT" Else importance = "IMPORTANCE_LOW"
Dim ChannelVisibleName As String = Application.LabelName
Channel.InitializeNewInstance("android.app.NotificationChannel", _
Array("MyChannelId1", ChannelVisibleName, manager.GetField(importance)))
manager = ctxt.RunMethod("getSystemService", Array("notification"))
manager.RunMethod("createNotificationChannel", Array(Channel))
Dim jo As JavaObject = ntf
jo.RunMethod("setChannelId", Array("MyChannelId1"))
End If
bv.Initialize
bv=ntf.GetNotification
bv.Notify(2)
such OnGoingEvent=true not worked
i use b4a version 9.01 and sdk 28
this not work in any device
i want my notification erasable and user can close this
help
what do i do?