Android Question push notifications-no icon display

kisoft

Well-Known Member
Licensed User
Longtime User
Hi
Notifications work normally but the application icon does not appear. The size of the icon is 25x25.

I made a test application and it is not displayed in normal notifications.
B4X:
    Dim n As Notification
    n.Initialize
    n.Icon = "icon"
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
hi
I use bv B4A 8.50
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
@DonManfred Thank you for this information. I have to try it.
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
I have implemented the NB6 class. However, the icon does not appear.
B4X:
    Log("Message arrived")
    Log($"Message data: ${Message.GetData}"$)

      Dim n As NB6
    Dim smiley As Bitmap
    smiley = LoadBitmapResize(File.DirAssets, "ikona3.png", 24dip, 24dip, False)
    n.Initialize("default", Application.LabelName, "DEFAULT").SmallIcon(smiley) ' normalnie "DEFAULT|
    Dim b As Bitmap = LoadBitmap(File.DirAssets, "imageslp2.jpg")
    n.BigPictureStyle(b.Resize(256dip, 256dip, True), _
        b, Message.GetData.Get("title"), Message.GetData.Get("body"))
    n.Color(0xFF00AEFF)
    n.Build("title", "collapsed content", "tag", Main).Notify(7)
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
Are you able to receive push notifications at all? Do you see the log messages?

1.Yes
2.Yes

I tested and works on Samsung and Huawei phones. On LG phones, notifications are but without an icon. I even changed the package name and created a new project in the F.B console. But still the same.
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
I modified the code a bit.
B4X:
    Log("Message arrived")
    Log($"Message data: ${Message.GetData}"$)
'    Dim n As Notification
'    n.Initialize
'    n.Icon = "icon"
'    n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
'    n.Notify(1)
'   
' *******************************PUSH1 MESSAGE ********************************
'    Dim n As NB6
'    Dim smiley As Bitmap
'    smiley = LoadBitmapResize(File.DirAssets, "iconsy2.png", 24dip, 24dip, False)
'    n.Initialize("default", Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(smiley)
'    n.Build(Message.GetData.Get("title"),  Message.GetData.Get("body"), "tag1", Main).Notify(4)
    
    Dim n As NB6
    Dim smiley As Bitmap
    smiley = LoadBitmapResize(File.DirAssets, "ikona3.png", 24dip, 24dip, False)
    n.Initialize("default", Application.LabelName, "DEFAULT").SmallIcon(smiley) ' normalnie "DEFAULT|
    Dim b As Bitmap = LoadBitmap(File.DirAssets, "imageslp2.jpg")
    n.BigPictureStyle(b.Resize(256dip, 256dip, True), _
        b, Message.GetData.Get("title"), Message.GetData.Get("body"))
    n.Color(0xFF00AEFF)
    n.Build(Message.GetData.Get("title"),  Message.GetData.Get("body"), "tag", Main).Notify(7)

B4X:
Logger połączony z:  LGE LG-D855
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
--------- beginning of system
** Activity (main) Pause, UserClosed = true **
** Receiver (firebasemessaging) OnReceive **
** Service (firebasemessaging) Start **
Message arrived
Message data: {body=asdasdsadadsada, title=ddsadsd}
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
Activity started from notification. Tag: tag
** Activity (main) Pause, UserClosed = true **
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
OK, it's working now.
I forgot that the notification icons are stylized by the android or phone( i'm not sure I am expressing myself clearly). In place of the icon a one-colored square is displayed.
 
Upvote 0
Top