B4J Question fcm not push through b4j

Discussion in 'B4J Questions' started by jimich, Mar 2, 2018.

  1. jimich

    jimich Member Licensed User

    Hi to all!

    I can receive notification (in b4a) through firebase notification console but I can't receive when it send through b4j.

    Here's my code:

    'jOkHttpUtils2_NONUI (Version 2.62)
    'Json (Version 1.10)
    'OkHttp (Version 1.20)

    'Non-UI application (console / server application)
    #Region  Project Attributes
    #MergeLibraries: True
    #End Region

    Sub Process_Globals
    'replaced last 8 with X:
        Private const API_KEY As String = "AIzaSyAj3llxMqUGGPlJhGyerIfd8FNnXXXXXXXX"
    End Sub

    Sub AppStart (Args() As String)
    End Sub

    Private Sub SendMessage(Topic As String, Title As String, Body As String)
    Dim Job As HttpJob
    "fcm", Me)
    Dim m As Map = CreateMap("to"$"/topics/${Topic}"$)
    Dim data As Map = CreateMap("title": Title, "body": Body)
    "data", data)
    Dim jg As JSONGenerator
    "https://fcm.googleapis.com/fcm/send", jg.ToString)
    "Authorization""key=" & API_KEY)
    End Sub

    Sub JobDone(job As HttpJob)
    If job.Success Then
    End If
    '<-- non ui app only
    End Sub
    And here's my log:

    [jobname=fcm, success=true, username=
    , password=, errormessage=, target=class jimich.com.myapp.main
    , taskid=1, req=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest@23ab930d, tag=java.lang.Object@4534b60d
    , httputils2service=null]

    Thank you for kind replies and God bless!
    Last edited: Mar 2, 2018
  2. Erel

    Erel Administrator Staff Member Licensed User

    The message was sent properly. Check your B4A or B4i implementation.
  3. jimich

    jimich Member Licensed User

    Thank you Erel for your reply. I'll check my B4A code.
  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