Android Question [SOLVED well at least documented] Problem with NB6 on APK 23

JackKirk

Well-Known Member
Licensed User
Longtime User
I'm playing around with the NB6 class from here:

https://www.b4x.com/android/forum/threads/nb6-notifications-builder-class-2018.91819/#content

And I'm using version 1.01 of NB6.bas

I am running on a Samsung 5S with APK 23.

I am specifically playing with HIGH and LOW priority notifications.

I have found I encounter the problem as outlined here:

https://www.b4x.com/android/forum/threads/nb6-example-problem.98872/#content

And have amended the NB6 example Main code as follows:
B4X:
Sub HighPriority_Notification
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "HIGH").SmallIcon(smiley)

    'This avoids a problem, see:
    'https://www.b4x.com/android/forum/threads/nb6-example-problem.98872/#content
    Dim notification As Notification = n.Build("", "", "", Me)
    notification.Cancel(9)
    notification.Notify(9)
 
    n.Build("Important!!!", "Content", "tag", Me).Notify(9)
End Sub

Sub LowPriority_Notification
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "LOW").SmallIcon(smiley)

    'This avoids a problem, see:
    'https://www.b4x.com/android/forum/threads/nb6-example-problem.98872/#content
    Dim notification As Notification = n.Build("", "", "", Me)
    notification.Cancel(10)
    notification.Notify(10)
 
    n.SetDefaults(False, False, False)
    n.Build("Not important...", "Content", "tag", Me).Notify(10)
End Sub

This solves the problem for HIGH priority but LOW priority bombs immediately with:
android.app.RemoteServiceException: Bad notification posted from package b4a.example3: Couldn't update icon: StatusBarIcon(icon=Icon(typ=RESOURCE pkg=b4a.example3 id=0x00000000) visible user=0 )
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2019)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
 

JackKirk

Well-Known Member
Licensed User
Longtime User
Erel,

With respect to:
B4X:
Sub LowPriority_Notification
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "LOW").SmallIcon(smiley)

    'This avoids a problem, see:
    'https://www.b4x.com/android/forum/threads/nb6-example-problem.98872/#content
    Dim notification As Notification = n.Build("", "", "", Me)
    notification.Cancel(10)
    notification.Notify(10)
  
    n.SetDefaults(False, False, False)
    n.Build("Not important...", "Content", "tag", Me).Notify(10)
End Sub
I have tried:

(1) Changing ID from 10 to 20
(2) Commenting out
n.SetDefaults(False, False, False)
(3) Changing
n.SetDefaults(False, False, False)
to
n.SetDefaults(True, True, True)
(4) Changing smiley source to "logo-02.png"
(5) Changing
n.Initialize("default", Application.LabelName, "LOW").SmallIcon(smiley)
to
n.Initialize("default", Application.LabelName, "DEFAULT").SmallIcon(smiley)
and
n.Initialize("default", Application.LabelName, "MIN").SmallIcon(smiley)

All fail immediately with the error noted in first post.

If I change
n.Initialize("default", Application.LabelName, "LOW").SmallIcon(smiley)
to
n.Initialize("default", Application.LabelName, "HIGH").SmallIcon(smiley)

It works repeatedly.

Any other tests you can think of?
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
B4X:
Sub LowPriority_Notification
    Dim n As NB6
    n.Initialize("Junk1", "Junk2", "LOW").SmallIcon(smiley)

    'This avoids a problem, see:
    'https://www.b4x.com/android/forum/threads/nb6-example-problem.98872/#content
    Dim notification As Notification = n.Build("", "", "", Me)
    notification.Cancel(10)
    notification.Notify(10)
    
    n.SetDefaults(False, False, False)
    n.Build("Not important...", "Content", "tag", Me).Notify(10)
End Sub

Exactly the same result - it only works if "LOW" is set to "HIGH" - "MIN" and "DEFAULT" do not work also.
 
Upvote 0
Top