Android Question Error in NB6 with channel

Christian García S.

Active Member
Licensed User
Hello, I am using the NB6 library.

When I send a notification with image from Firebase (Remote Notification) I dont have issues, but when I send local notification with Image I recieved this error:

B4X:
Error occurred on line: 295 (NB6)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
    at com.innobix.fontana.nb6._build(nb6.java:319)
    at com.innobix.fontana.globals._pushwithimage(globals.java:943)
    at com.innobix.fontana.imagedownloader$ResumableSub_DownloadImage.resume(imagedownloader.java:315)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:735)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:357)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:245)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
    at anywheresoftware.b4a.BA$2.run(BA.java:365)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6938)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.IllegalArgumentException
    at android.os.Parcel.readException(Parcel.java:1962)
    at android.os.Parcel.readException(Parcel.java:1904)
    at android.app.INotificationManager$Stub$Proxy.createNotificationChannels(INotificationManager.java:1488)
    at android.app.NotificationManager.createNotificationChannels(NotificationManager.java:490)
    at android.app.NotificationManager.createNotificationChannel(NotificationManager.java:478)
    ... 24 more


The function is this, first I call PUSH later depends on if notification have an image send Push or PushwithImage:

B4X:
Sub PushwithImage(Titulo As String, Texto As String, b As Bitmap)
    Dim n As NB6
         
    IdNotification = IdNotification + 1
    n.Initialize("default", Titulo, "HIGH").AutoCancel(True).SmallIcon(SmallLogo)
    n.LargeIcon( LargeLogo   )
    n.BigPictureStyle(LargeLogo, b, Titulo, Texto)
    n.Color(0xFF00AEFF)
    n.ShowWhen(DateTime.Now)
    n.Build(Titulo, Texto, Titulo, act_notificaciones).Notify(IdNotification)
End Sub

Sub Push(Titulo As String, Texto As String, Image As String)    
 
    ' Si existe imagen hay vista previa y notifica
    If Image.Length > 0 Then    
        Dim b As Bitmap
        CallSubDelayed3(ImageDownloader,"DownloadImage",Image,b)
    Else
        Dim n As NB6
        IdNotification = IdNotification + 1
        n.Initialize("default", Titulo, "HIGH").AutoCancel(True).SmallIcon(SmallLogo)
        n.LargeIcon(LargeLogo)
        n.ShowWhen(DateTime.Now)
        n.Build(Titulo, Texto, Titulo, act_notificaciones).Notify(IdNotification)
    End If
End Sub

I have in ImageDownloader this:

B4X:
Sub DownloadImage(image As String, bmp As Bitmap)
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(image)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        bmp = J.GetBitmap
        Globals.PushwithImage(Globals.TitlePush, Globals.BodyPush, bmp)
    Else
        Globals.Push(Globals.TitlePush, Globals.BodyPush, "")
    End If
    j.Release
End Sub

Thanks.
 
Last edited:

Similar Threads

Top