B4J Question Test firebase B4J_FCM_PUSH can't run.

Discussion in 'B4J Questions' started by Åke Artklo Bravida, Jul 25, 2019.

  1. Åke Artklo Bravida

    Åke Artklo Bravida Member Licensed User

    I can´t run B4J FCM_Push code to test firebase.
    I gott error on this line m.Put("data": data)
    Logg error ','expected.
    Unused variable 'data'.(warning #9)

    I use B4J Ver: 7.32

    How can I solve this?

    Thank you very much for your help.

    Code:
    Private Sub SendMessage(Topic As String, Title As String, Body As String)
     
    Dim Job As HttpJob
     Job.Initialize(
    "fcm", Me)
     
    Dim m As Map = CreateMap("to"$"/topics/${Topic}"$)
     
    Dim data As Map = CreateMap("title": Title, "body": Body)
     m.Put(
    "data": data)
     
    Dim jg As JSONGenerator
     jg.Initialize(m)
     Job.PostString(
    "https://fcm.googleapis.com/fcm/send", jg.ToString)
     Job.GetRequest.SetContentType(
    "application/json")
     Job.GetRequest.SetHeader(
    "Authorization""key=" & API_KEY)
    End Sub
     
    Last edited: Jul 25, 2019
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You should edit the first post and add code tags.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. Åke Artklo Bravida

    Åke Artklo Bravida Member Licensed User

    Yes, that fixed the problem.:)

    Thank you very much.
     
Loading...
  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