1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question How can i pass parameter from firebase messaging to a layout activity in my app

Discussion in 'Android Questions' started by Makumbi, Aug 5, 2019.

  1. Makumbi

    Makumbi Active Member Licensed User

    Example iam currently using NB6 for notification alerts now i to to pass the message from firebase to NB6
    Dim n As NB6
    "default"Application.LabelName, "HIGH").SmallIcon(smiley)
    "sms"), "Kabojja Junior School", quot.Get("sms"), Sendsms).Notify(9)
  2. DonManfred

    DonManfred Expert Licensed User

    Add additional Values when sending the Notification from your Serverside
    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) ' Add more Data to this Map
        If Topic.StartsWith("ios_"Then
    Dim iosalert As Map =  CreateMap("title": Title, "body": Body, "sound""default")
    "notification", iosalert)
    End If
    "data", data)
    Dim jg As JSONGenerator
    "https://fcm.googleapis.com/fcm/send", jg.ToString)
    "Authorization""key=" & API_KEY)
    End Sub
    The Data can be extracted in the sub fm_MessageArrived (Message As RemoteMessage)

    for ex.
    If Message.GetData.ContainsKey("sms"Then
    dim sms as string = Message.GetData.Get("sms")
    End if
    It is up to you then to decide what to do with the additional Infos you get.

    NOTE that the Messagepayload is limited. You can not transfer unlimited Data.

    It is helpful if you just understand how the FirebaseNotification System is working.
    Last edited: Aug 5, 2019
    Erel, mangojack, BillMeyer and 2 others like this.
  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