Hello all, I use below code to send notification (Both IOS and Android). When i send from android to IOS, IOS is working fine. But when i use below code to send from
IOS to Android, The message arrive as notification. But when i click on the (Top drag down) notification, The android application wont launch..
Send Notification Code :
Android will only launch correctly (*By clicking on top dropdown notification) ONLY if i take out these 2 lines :
Taking out both line above will eventually cause IOS not receive the message... ?
IOS to Android, The message arrive as notification. But when i click on the (Top drag down) notification, The android application wont launch..
Send Notification Code :
B4X:
'******************************************************
'SEND TO NOTIFICATION GROUP
'******************************************************
Public Sub TW_Notifi_SendGroup(strTopic As String, Title As String, Body As String)
Dim Job As HttpJob
Job.Initialize("fcm", Me)
Dim m As Map = CreateMap("to": $"/topics/${strTopic}"$)
Dim data As Map = CreateMap("title": Title, "body": Body)
Dim iosalert As Map = CreateMap("title": Title, "body": Body, "sound": "default")
m.Put("notification", iosalert)
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;charset=UTF-8")
Job.GetRequest.SetHeader("Authorization", "key=" & TW_Notifikey)
End Sub
Android will only launch correctly (*By clicking on top dropdown notification) ONLY if i take out these 2 lines :
B4X:
'******************************************************
'SEND TO NOTIFICATION GROUP
'******************************************************
Public Sub TW_Notifi_SendGroup(strTopic As String, Title As String, Body As String)
Dim Job As HttpJob
Job.Initialize("fcm", Me)
Dim m As Map = CreateMap("to": $"/topics/${strTopic}"$)
Dim data As Map = CreateMap("title": Title, "body": Body)
Dim iosalert As Map = CreateMap("title": Title, "body": Body, "sound": "default") <<<----- TAKE OUT THIS
m.Put("notification", iosalert) <<<--------- TAKE OUT THIS
m.Put("priority", 10)
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;charset=UTF-8")
Job.GetRequest.SetHeader("Authorization", "key=" & TW_Notifikey)
End Sub
Taking out both line above will eventually cause IOS not receive the message... ?