If I use the following demo code I do not have the "Clear" button in the message view. Any one know know to get the "Clear" button so I can clear the view
B4X:
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.SetInfo("This is the title", "and this is the body.", "")
'Change Main (above) to "" if this code is in the main module.
n.Notify(1)
The "Clear" button is not part of the notification, the OS adds that; unless you are referring to clear the notification, in that case you have to add:
On my phone (HTC One X) the message view is split up in two parts.
The upper part with has the headline "Running" and below that others with the headline "Messages". When I receive a SMS the notification it is under "Messages" and I can "Clear" them. With the demo code the notification is under "Running" and can not be cleared.
How do I get my notification down under "Messages" so the "Clear" button appears.
Yes,
I also have tried to put n.AutoCancel = True after n.Notify(1)
B4X:
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.AutoCancel = True
n.SetInfo("This is the title", "and this is the body.", "")
'Change Main (above) to "" if this code is in the main module.
n.Notify(1)
Thanks for your help, but it is still not working :BangHead:
B4X:
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.AutoCancel = True
n.OnGoingEvent = False
n.SetInfo("This is the title", "and this is the body.", "")
'Change Main (above) to "" if this code is in the main module.
n.Notify(1)
I have the previous code in main activity, and this code in my service module with the purpose that the service not killed.
If I unmark " 'Notification1.Icon = "icon"" this notification is shown all the time and I do not want that.
Then I made the other notification for the purpose of showing messages.
B4X:
Sub Service_Create
SMSInt.Initialize2("smsint", 999)
Notification1.Initialize
'Notification1.Icon = "icon" 'use the application icon file for the notification
Notification1.AutoCancel = True
Notification1.OnGoingEvent = False
Notification1.Sound = False
Notification1.Light = False
Notification1.Vibrate = False
'Make sure that the process is not killed
Service.StartForeground(1, Notification1)
End Sub