Android Question Error on Notification

imak123

Member
When I run the following code, I got an error : java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=channel_3 pri=0 contentView=null vibrate=default sound=default defaults=0xffffffff flags=0x10 color=0x00000000 vis=PRIVATE). I have place the icon image under \Objects\res\drawable directory.
Would anyone give some advise ?

Thanks

Code :


Sub Activity_Pause (UserClosed As Boolean)
n.Initialize()
n.Cancel(1)

End Sub


Sub ReadFromFile
Dim fdName,srcDir As String
srcDir = File.DirAssets
fdName ="introb4a.txt"
If File.Exists(srcDir,fdName) Then
lbDoc.Text = File.GetText(srcDir,fdName)
n.Initialize()
n.Icon ="warning"
n.AutoCancel=True
n.SetInfo("Read file","Completed !","")
n.Notify(1) <--Error occur on this line
Else
ToastMessageShow("Cannot get the File !",False)
End If

End Sub
 

John Naylor

Active Member
Licensed User
Longtime User
Hint - Use the code tag it makes your post much easier to read....


B4X:
Sub Activity_Pause (UserClosed As Boolean)
    n.Initialize()
    n.Cancel(1)

End Sub


Sub ReadFromFile
    Dim fdName,srcDir As String
    srcDir = File.DirAssets
    fdName ="introb4a.txt"
    If File.Exists(srcDir,fdName) Then
        lbDoc.Text = File.GetText(srcDir,fdName)
        n.Initialize()
        n.Icon ="warning"
        n.AutoCancel=True
        n.SetInfo("Read file","Completed !","")
        n.Notify(1) <--Error occur on this line
    Else
        ToastMessageShow("Cannot get the File !",False)
    End If

End Sub
 
Upvote 0

John Naylor

Active Member
Licensed User
Longtime User
You're welcome! If that does the trick for you then you should edit the thread and put [Solved] in front of your title.
 
Upvote 0
Top