Hi There
Can someone tell me what is the best way to decode this type of message received from GCM server ( In particular I need the contents of the data block )
[ code ]
{
"registration_ids": [ "SomeKey" ],
"data": {"tickerText":"hello", "contentTitle":"hello2", "message": "Test Push Notification message "},
"collapse_key": "test",
}
[ /code ]
I am using the following code that I extracted from one of the samples
[ code ]
Sub MessageArrived (Intent As Intent)
Dim From, CollapseKey, data As String, data2 As String, data3 As String, datamessage As String
If Intent.HasExtra("from") Then
From = Intent.GetExtra("from")
End If
If Intent.HasExtra("data") Then
data = Intent.GetExtra("data")
End If
If Intent.HasExtra("collapse_key") Then
CollapseKey = Intent.GetExtra("collapse_key")
End If
'Here you should handle the new message:
Log("New message arrived: " & data & " " & data2 & " " & data3)
ToastMessageShow("New message: " & data, True)
End Sub
[ /code ]
This section of the code never returns true
[ code ] Intent.HasExtra("data") [ code ]
Thanks
Can someone tell me what is the best way to decode this type of message received from GCM server ( In particular I need the contents of the data block )
[ code ]
{
"registration_ids": [ "SomeKey" ],
"data": {"tickerText":"hello", "contentTitle":"hello2", "message": "Test Push Notification message "},
"collapse_key": "test",
}
[ /code ]
I am using the following code that I extracted from one of the samples
[ code ]
Sub MessageArrived (Intent As Intent)
Dim From, CollapseKey, data As String, data2 As String, data3 As String, datamessage As String
If Intent.HasExtra("from") Then
From = Intent.GetExtra("from")
End If
If Intent.HasExtra("data") Then
data = Intent.GetExtra("data")
End If
If Intent.HasExtra("collapse_key") Then
CollapseKey = Intent.GetExtra("collapse_key")
End If
'Here you should handle the new message:
Log("New message arrived: " & data & " " & data2 & " " & data3)
ToastMessageShow("New message: " & data, True)
End Sub
[ /code ]
This section of the code never returns true
[ code ] Intent.HasExtra("data") [ code ]
Thanks