Android Question Notification icon

jvrh_1

Active Member
Licensed User
Hello,

I am trying to show my icon's app in the notification bar of my app, but It does not appear. Only appear a gray circle.
It is a 72X72 pixels icon. I choose it in the "Poyect"--> Choose icon in the B4A tab.
I have tried put the file "read only" permison in the "\Objects\res\drawable" file, but when I do it, the icon of my app disapear.

This is my code:

B4X:
Dim n As Notification
n.Initialize
n.Icon ="icon"
n.Sound=True
n.SetInfo(Message.GetData.Get("title"), men, Main)
n.Notify(1)

Please, help.
 

jvrh_1

Active Member
Licensed User
Better to use NB6 and set SmallIcon: NB6 - Notifications Builder class (2018)

I tried but the same result. I am using this code:

B4X:
Dim n As NB6
Private dibujo As Bitmap
dibujo = LoadBitmapResize(File.DirAssets, "ICONO 72 PLANO.png",72dip, 72dip, False)
n.Initialize("default", "my app", "DEFAULT").AutoCancel(True).SmallIcon(dibujo)
n.Build("myapp","text", "tag1", Main).Notify(4) 'It will be Main (or any other activity) instead of Me if called from a service.

Attached image of this. Any idea. It works like using notification object.
 

Attachments

  • notificacion.jpg
    notificacion.jpg
    38 KB · Views: 220
Upvote 0

jvrh_1

Active Member
Licensed User
Yes, There is a file that is called icon.png. This file is the file that I have choose in the B4A (project -- choose icon) and it has got 624 * 610 pixels. The file that I want to show in my notification bar using NB6 has got 72*72 pixels and it is in my files tab of my poject. It is a different picture.
 
Last edited:
Upvote 0

jvrh_1

Active Member
Licensed User
Please reply to this post by attaching your Icon...

In NB6, you should use this line...
B4X:
    NB.SmallIcon = "icon"

In Notification you should use this line...
B4X:
    Noti.Icon = "icon"

Enjoy...


This are the files.
Icono 72 plano.png is the notification icon.
Icono app.png is the app icon.

Yes, I already using "smallicon". Look: n.Initialize("default", "my app", "DEFAULT").AutoCancel(True).SmallIcon(dibujo)

I do not know where is my mistake.
 

Attachments

  • ICONO 72 PLANO.png
    ICONO 72 PLANO.png
    6.7 KB · Views: 133
  • ICONO APP.png
    ICONO APP.png
    87.6 KB · Views: 132
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
This are the files.
Icono 72 plano.png is the notification icon.
Icono app.png is the app icon.

Yes, I already using "smallicon". Look: n.Initialize("default", "my app", "DEFAULT").AutoCancel(True).SmallIcon(dibujo)

I do not know where is my mistake.

Oh wait a minute,
That is actually correct, colorwise it will not show up in color, just in gray...
 
Upvote 0

jvrh_1

Active Member
Licensed User
No. I have checked with a lot of different icons with different compositions. Now, I am using this one for test because it is the simpliest one, but it is not de definitively.
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
Newer versions of android simplify and decolour the icon for notifications. So a simple, plain circle is what I qould expect for the above yellow circulat object. When it be 3d or 2d.
 
Upvote 0

jvrh_1

Active Member
Licensed User
I have tested with this icon and happens the same. I have not got any 3d or 3d effect. It is a image with letters only.
 

Attachments

  • icononotif.png
    icononotif.png
    2.2 KB · Views: 140
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
did you clean the project in between before re-compiling?
 
Upvote 0

jvrh_1

Active Member
Licensed User
Yes I did.
When I changed the round yellow circle icon by the other icon (the last one), the notification changed too, but in this case, it shows a gray rectangle (before it was a gray circle)
 

Attachments

  • notif.jpg
    notif.jpg
    26.7 KB · Views: 153
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
Yes that is what I would expect from the pictures shown as there is no transparency.
 
Upvote 0

jvrh_1

Active Member
Licensed User
What are corrects the extension? *.png, *.jpg?
The first one has got transparencies, but the second one not.
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
I'd stick to png.
If you were to create the second with just letters on a transparent background, it should show the letters
 
Upvote 0

jvrh_1

Active Member
Licensed User
I'd stick to png.
If you were to create the second with just letters on a transparent background, it should show the letters

The last one, the background is white (not transparency). Background is a rectangle white with red letters.
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
The last one, the background is white (not transparency). Background is a rectangle white with red letters.
Yes, I can see that. That is why I said you would need to create it with transparent background for the letters to show.
I'm not 100% sure, but if you target a lower sdk in the manifest, to one before the notification icon display changed, it may show that icon as is, but that will come with other issues, so best not to do it.
 
Upvote 0

jvrh_1

Active Member
Licensed User
Ok. Perfect. Thanks.
It works now. It shows a black and white image. All the things that is in colours appears in dark grey or black and the transparencies in white.
 
Upvote 0
Top