Android Question Always on Display - Notification Icon [Huawei Mate 20 Pro]

Discussion in 'Android Questions' started by Nerdworld, Aug 21, 2019.

  1. Nerdworld

    Nerdworld Member Licensed User

    Hey folks!

    I'm currently running into an issue with one of my apps:

    - My app has a constant notification for a running service
    - On my old phone (Samsung Galaxy S7 Edge) i had a small version of my app icon on the "always on"-display.
    - On my new phone (Huawei Mate 20 Pro) there is a small green rectangle instead of an icon
    - There is no problem with the "normal" notification bar, the icon is shown properly.

    I've already tried to use different methods of creating the notification (e.g. librarys, notification builder etc.), without success.

    Best regards
    Daniel
     

    Attached Files:

    Last edited: Aug 21, 2019
  2. Erel

    Erel Administrator Staff Member Licensed User

    Not sure that I understand. Is the problem the way the icon looks? Can you upload the icon file?
     
  3. Nerdworld

    Nerdworld Member Licensed User

    I tried several icon files, none of them are working - they are all displayed as a green rectangle (on my always-on-display).
    They are working absolutly fine everywhere else (notification bar, app drawer, ...).

    I'm using B4A 8.30.
     

    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

  5. Nerdworld

    Nerdworld Member Licensed User

    I
    It's not just ignoring the colors, it's just displaying a green rectangle instead of the icon (see the photo on my first post).
    Other icons (e.g. WhatsApp) are displayed fine.

    I also tried using a black and white-version, a smaller version and different versions with transparent / intransparent background.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    The icon should act like a mask. Delete your icon and test it with the default icon. Does it work better?
     
  7. Nerdworld

    Nerdworld Member Licensed User

    The default icon isn't working as well - while the B4A-bridge icon is displayed correctly (A with a small tick).
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    1. Post the code that creates the notification.

    2. Post a screenshot of the device while it is unlocked and the icon should appear at the top.
     
  9. Nerdworld

    Nerdworld Member Licensed User

    Code:
    Dim Notif As Notification : Notif.Initialize
    Notif.Icon = 
    "icon"
    Notif.OnGoingEvent = 
    True
    Notif.SetInfo(
    "Luna""", Main)
    Alternative version:

    Code:
    Dim smiley As Bitmap = LoadBitmapResize(File.DirAssets, "test.png"24dip24dipFalse)
    Dim Notif As NB6
    Notif.Initialize(
    "default"Application.LabelName, "DEFAULT")
    Notif.SmallIcon(smiley)
    Dim NotifObj As Notification = Notif.Build("Luna""""tag1", Main)
     

    Attached Files:

  10. Erel

    Erel Administrator Staff Member Licensed User

    I don't see your icon in the screenshot.
    I'm also not sure that the green box is your icon on the lock screen. Where is B4A-Bridge icon there?
     
  11. Nerdworld

    Nerdworld Member Licensed User

    I'm using the default icon in the screenshot (blue icon).
    I'm 100% sure it is the green box on my rectangle - i can literally turn it on and off my closing my apps notification.

    Edit: i also uploaded it with my own icon, here:
     

    Attached Files:

  12. Erel

    Erel Administrator Staff Member Licensed User

    Where is B4A-Bridge icon on the lock screen?

    Can you upload a small project with the notification code and icon?
     
  13. Nerdworld

    Nerdworld Member Licensed User

    The Mate 20 Pro has a notch, so it's not always displaying all icons in the upper notification bar - but it's indeed displaying everything on the always-on-display.

    I've created a new project with a notification - and now it's a small red line instead of a box.
     

    Attached Files:

  14. Erel

    Erel Administrator Staff Member Licensed User

    You should use File - Export as zip when uploading projects.

    Your code is wrong. If you set the automatic foreground mode to ALWAYS then you shouldn't call StartForeground yourself.

    Better to test it with:
    Code:
    Dim Notif As Notification : Notif.Initialize
    Notif.Icon = 
    "icon"
    Notif.OnGoingEvent = 
    True
    Notif.SetInfo(
    "Luna""", Me)
    Notif.Notify(
    1)
    Service.StartForeground(1, Notif)
    I guess that the result will be the same. You will need to play with icons with different sizes.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice