Android Question format message of Message.GetData

Isac

Active Member
Licensed User
Longtime User
How can I format the message I receive from b4j?


----> b4a

B4X:
map = CreateMap("title1":"","body1":Message.GetData)


In this condition I receive the message like this:

Message data: ID 0:1532168813401338%959093b8f9fd7ecd, Data {body=GOOD DAY, title= HELLO}



I should delete this when I put the message in a label

B4X:
{body=    , title=  }

then enter it here

B4X:
Label3.Text = root.Get ("body1")






thank you
 
Last edited:

Isac

Active Member
Licensed User
Longtime User
I need your help :)

java.lang.NumberFormatException: For input string: Data "{body=GOOD DAY, title= HELLO}"



---------->b4a

B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
    Log("Message arrived")
    Log($"Message data: ID ${Message.MessageId}, Data ${Message.GetData}"$)
    Log("Message="& Message)
    Dim value As Int
    Dim map As Map :map.Initialize   
    map = CreateMap("body1":Message.GetData,"title1":Message.GetData)
    For Each key As String In map.Keys
    value = map.Get(key)
    Log("valore="+value)
    Next
 
Upvote 0
Top