aaronk Well-Known Member Licensed User Longtime User Aug 14, 2017 #1 Hi, I am trying to play a icon in the notification bar, but for some reason I can't get the icon to display. I am using: Code: Copy n.Initialize n.OnGoingEvent = True n.Sound = False n.Vibrate = False n.Icon = "icon" n.SetInfo("App is running" , "tap to stop app" , Main) n.Notify(1) in the Objects\res\drawable I have my icon (icon.png) The text displays but the only the icon is not showing. Any ideas on what I have done wrong ?
Hi, I am trying to play a icon in the notification bar, but for some reason I can't get the icon to display. I am using: Code: Copy n.Initialize n.OnGoingEvent = True n.Sound = False n.Vibrate = False n.Icon = "icon" n.SetInfo("App is running" , "tap to stop app" , Main) n.Notify(1) in the Objects\res\drawable I have my icon (icon.png) The text displays but the only the icon is not showing. Any ideas on what I have done wrong ?
DonManfred Expert Licensed User Longtime User Aug 14, 2017 #2 aaronk said: in the Objects\res\drawable I have my icon (icon.png) Click to expand... and it is set to readonly to not be removed while compiling? Upvote 0
aaronk said: in the Objects\res\drawable I have my icon (icon.png) Click to expand... and it is set to readonly to not be removed while compiling?
aaronk Well-Known Member Licensed User Longtime User Aug 14, 2017 #3 DonManfred said: and it is set to readonly to not be removed while compiling? Click to expand... Yeah it's set to read only. After compiling the app I checked and it's still there. Upvote 0
DonManfred said: and it is set to readonly to not be removed while compiling? Click to expand... Yeah it's set to read only. After compiling the app I checked and it's still there.
Erel B4X founder Staff member Licensed User Longtime User Aug 14, 2017 #4 I've tested this code in a project and it works: Code: Copy Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("1") Dim n As Notification n.Initialize n.OnGoingEvent = True n.Sound = False n.Vibrate = False n.Icon = "icon" n.SetInfo("App is running" , "tap to stop app" , Me) n.Notify(1) End Sub Upvote 0
I've tested this code in a project and it works: Code: Copy Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("1") Dim n As Notification n.Initialize n.OnGoingEvent = True n.Sound = False n.Vibrate = False n.Icon = "icon" n.SetInfo("App is running" , "tap to stop app" , Me) n.Notify(1) End Sub
udg Expert Licensed User Longtime User Aug 14, 2017 #5 You may want to check your specific notification icon format against Android's rules: https://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html udg Upvote 0
You may want to check your specific notification icon format against Android's rules: https://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html udg
aaronk Well-Known Member Licensed User Longtime User Aug 15, 2017 #6 This is odd. I started a blank project and used the code from post 4. It worked. I then copied the icon I was using in my main app to this new project and it still worked. I then thought there must be something in my main app that was causing it to fail. I then started copying module by module to the new app and it still worked. I ended up copying every module (kept the same names for everything) and it still worked. My main app is failing, but the new project is working even knowing it contains the same files & code. Not a major thing since I have now copied everything over, but not sure what is caused this to happen and hopefully this doesn't happen again later on. Upvote 0
This is odd. I started a blank project and used the code from post 4. It worked. I then copied the icon I was using in my main app to this new project and it still worked. I then thought there must be something in my main app that was causing it to fail. I then started copying module by module to the new app and it still worked. I ended up copying every module (kept the same names for everything) and it still worked. My main app is failing, but the new project is working even knowing it contains the same files & code. Not a major thing since I have now copied everything over, but not sure what is caused this to happen and hopefully this doesn't happen again later on.
Sandman Expert Licensed User Longtime User Aug 26, 2017 #7 I recently changed my notification icon and I had to do a Clean project to get the new icon to show up. Upvote 0
I recently changed my notification icon and I had to do a Clean project to get the new icon to show up.
aaronk Well-Known Member Licensed User Longtime User Aug 27, 2017 #8 Sandman said: I recently changed my notification icon and I had to do a Clean project to get the new icon to show up. Click to expand... Yeah, I tried that and still had the same issue. It seems to be still working in the new project, so all good. Upvote 0
Sandman said: I recently changed my notification icon and I had to do a Clean project to get the new icon to show up. Click to expand... Yeah, I tried that and still had the same issue. It seems to be still working in the new project, so all good.
Aviles Member Licensed User Longtime User Apr 4, 2018 #9 Hi, I had a similar problem. I added a second icon and I set as read-only, but when I tried to use in a notification I had the follow error: "Invalid notification (no valid small icon)". I followed the suggestions of this post, and it works, but If I adds another icon this doesn't work. so after try I found that If you adds a second, third, fourth icon you just only should compile your project in release mode to do it work. after, you can change to debug mode and it will working. Note: You should be follow the Android Icons guidelines https://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html Upvote 0
Hi, I had a similar problem. I added a second icon and I set as read-only, but when I tried to use in a notification I had the follow error: "Invalid notification (no valid small icon)". I followed the suggestions of this post, and it works, but If I adds another icon this doesn't work. so after try I found that If you adds a second, third, fourth icon you just only should compile your project in release mode to do it work. after, you can change to debug mode and it will working. Note: You should be follow the Android Icons guidelines https://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html