rfresh Well-Known Member Licensed User Longtime User Dec 3, 2018 #1 I have two questions as I try to add my Notification code below. 1. My 'Main' activity gives me an undeclared variable 'main' used before assigned a value, in the SetInfo line below. Am I inserting my Notification code in the right location? I have it in Activity_Create. 2. My notification icon does show up at the top, but it's just a blank square and not the default icon image. I'm using (for now) the default icon.png file in C:\Users\rfresh\Documents\B4A\Ice\Objects\res\drawable Ice is my project folder. Thanks for any help. Code: Dim n As Notification n.Initialize n.OnGoingEvent = True n.Sound = False n.Vibrate = False n.Icon = "icon" n.SetInfo("Test1" , "Test2" , Main) n.Notify(1)
I have two questions as I try to add my Notification code below. 1. My 'Main' activity gives me an undeclared variable 'main' used before assigned a value, in the SetInfo line below. Am I inserting my Notification code in the right location? I have it in Activity_Create. 2. My notification icon does show up at the top, but it's just a blank square and not the default icon image. I'm using (for now) the default icon.png file in C:\Users\rfresh\Documents\B4A\Ice\Objects\res\drawable Ice is my project folder. Thanks for any help. Code: Dim n As Notification n.Initialize n.OnGoingEvent = True n.Sound = False n.Vibrate = False n.Icon = "icon" n.SetInfo("Test1" , "Test2" , Main) n.Notify(1)
DonManfred Expert Licensed User Longtime User Dec 3, 2018 #2 You should use the notificationbuilder class https://www.b4x.com/android/forum/threads/nb6-notifications-builder-class-2018.91819/ Upvote 0
You should use the notificationbuilder class https://www.b4x.com/android/forum/threads/nb6-notifications-builder-class-2018.91819/
Erel B4X founder Staff member Licensed User Longtime User Dec 4, 2018 #4 DonManfred said: You should use the notificationbuilder class https://www.b4x.com/android/forum/threads/nb6-notifications-builder-class-2018.91819/ Click to expand... Small clarification as there are two relevant libraries for more advanced notifications: NotificationBuilder - Supported by Android 7- NB6 - Custom features supported by Android 6+. Shows standard notifications on older devices. You can use NB6 alone or both libraries. Upvote 0
DonManfred said: You should use the notificationbuilder class https://www.b4x.com/android/forum/threads/nb6-notifications-builder-class-2018.91819/ Click to expand... Small clarification as there are two relevant libraries for more advanced notifications: NotificationBuilder - Supported by Android 7- NB6 - Custom features supported by Android 6+. Shows standard notifications on older devices. You can use NB6 alone or both libraries.