Android Question FCM notification NULL

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Hi
I created app following this post:
https://www.b4x.com/android/forum/t...s-firebase-cloud-messaging-fcm.67716/#content
It is working fine but there is a problem:
When I sending message while app is running in background; I got notification icon with message title/body text as written fine.
But when I sending message while app is running in foreground; I got notification icon with message title/body text as "null" !!!
What is the problem?
 

DonManfred

Expert
Licensed User
Longtime User
How are you sending the Message? With the B4J Code?
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Excellent,
sent successfully from aspx vb, Its notification output as your B4J code, i got it whatever b4a app in foreground or background ...
my vb.net code is:
B4X:
''using system.net webclient
        Dim wc As New WebClient
        wc.Encoding = Encoding.UTF8
        wc.Headers.Add("Content-Type", "application/json")
        wc.Headers.Add("Authorization", "key=yourlongkey")
        Dim jsonvalues As String
        jsonvalues = "{""data"":{""title"":""This is the title"",""body"":""Hello!!!!""},""to"":""\/topics\/general""}"
        wc.UploadString("https://fcm.googleapis.com/fcm/send", jsonvalues)

the problem was in jsonvalues syntax

Thank you very much for your help ...
 
Upvote 0
Top