Faced with such an interesting problem. I use firebase for chat app on andoid and ios. When I send a message from android, everything works well (the notification will be sent to both ios and android), but when I send a message from ios, it will only be sent to android and sub Application_RemoteNotification will not be called.
This is my code for send message:
I am subscribed to this topic (I see messages from android)
FCMConnected
PushToken: 1
Topic name start with "ios_"
This is my code for send message:
B4X:
Private Sub SendMessageToIos(Topic As String, data As Map)
Log(Topic)
Dim Job As HttpJob
Job.Initialize("fcmIOS", Me)
Dim m As Map = CreateMap("to": $"/topics/${Topic}"$)
If Topic.StartsWith("ios_") Then
Dim iosalert As Map = CreateMap("title": data.Get("Title"), "body": data.Get("body"), "sound": "default")
m.Put("notification", iosalert)
m.Put("priority", 10)
m.Put("content_available", True)
End If
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=" & WebApiKey)
End Sub
I am subscribed to this topic (I see messages from android)
FCMConnected
PushToken: 1
Topic name start with "ios_"
Last edited: