Android Question Firebase error in foreground

José Daniel Pozo Zamora

New Member
Licensed User
Hi everyone,
I have a problem, the firebase messages work fine when the application is in the background, but when it is in the foreground throw this error and close the application.
Thanks for your help beforehand


FirebaseMessaging not found.
** Activity (main) Resume **
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference
at android.content.ComponentName.<init>(ComponentName.java:131)
at android.content.Intent.<init>(Intent.java:6448)
at anywheresoftware.b4a.objects.FirebaseNotificationsService.createIntent(FirebaseNotificationsService.java:51)
at anywheresoftware.b4a.objects.FirebaseNotificationsService$1.run(FirebaseNotificationsService.java:61)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
 

José Daniel Pozo Zamora

New Member
Licensed User
my code :
B4X:
Dim n As Notification
    n.Initialize
    n.Icon = "icon"
    n.Number = 1
    n.Light=True
    n.Sound=True
    n.Vibrate=True
    n.AutoCancel = True
    If Message.GetData.Get("message") <> Null Then
        Try
            n.SetInfo( Message.GetData.Get("titulo"), Message.GetData.Get("body"), Main)
            n.Notify(Message.GetData.Get("id"))
        Catch
            Log(LastException)
        End Try
    End if
 
Upvote 0
Top