'---------------------------------------------------------
Sub Process_Globals
Dim AlarmID As Int
Dim DescriptionTitle As String
Dim DescriptionBody As String
Dim DoneSuccessfully As Boolean
Dim Notification1 As Notification
End Sub
Sub Service_Create
Notification1.Initialize
Notification1.Icon = "icon" 'use the application icon file for the notification
Notification1.Vibrate = True
Notification1.SetInfo(DescriptionTitle, DescriptionBody, "") ' Main)
Notification1.Sound = True
Notification1.AutoCancel =True
End Sub
Sub Service_Start (StartingIntent As Intent)
Service.StartForeground(1, Notification1)
End Sub
'----------------------------------
notification is activated properly !!
1) Why clicking on the notification can not be erased automatically? (Notification1.AutoCancel =True)
2) if I try to manually delete it by ID, notification is NOT DELETED!!!
I encountered the same problem and I still have small question
is there a difference between
1 .nofification.nofify
2 .Service.StartForeground(1,notification) ??
I did not called startforeground but yet as I defined the notification to autocancel it won't work with nortification.cancel !
The solution remains to call
CallSub(myservice,"off_front") where off_front will stop foreground state of the service.
Please coment to clear things out about notification.cancel option !
Thanks
this is from Erel's tutorial and it works just fine
All parameters must be difined in the same place with the nofification.initialise statement
nofification.notify can be triggered when needed.
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim n1, n2 As Notification
n1.Initialize
n1.Icon = "icon"
n1.SetInfo("n1", "n1", "")
n2.Initialize
n2.Icon = "icon"
n2.SetInfo("n2", "n2", "")
n1.Notify(1)
n2.Notify(2)
End Sub