I have to send push notifications to each token, not to topics. The old code works, bur under the new one, i make something wrong.
Does anyone have experience with this? Thanks for help.
Does anyone have experience with this? Thanks for help.
B4X:
Public Sub SendMessageTo(Devices As List, msg As Map)
...
Dim m As Map = CreateMap("registration_ids": Devices)
m.Put("data", msg)
m.Put("android", CreateMap("priority": "high"))
Dim jg As JSONGenerator
jg.Initialize(CreateMap("message": m))
Job.PostString($"https://fcm.googleapis.com/v1/projects/${Main.ProjectId}/messages:send"$, jg.ToString)
Job.GetRequest.SetContentType("application/json;charset=UTF-8")
Job.GetRequest.SetHeader("Authorization", "Bearer " & Token)
.....
B4X:
2024-03-28 18:42:56.336 [PushServer] INFO - 1 Android-Geraete werden gepusht!
ResponseError. Reason: , Response: {
"error": {
"code": 400,
"message": "Invalid value at 'message.data[3].value' (TYPE_STRING), 62\nInvalid value at 'message.data[7].value' (TYPE_STRING), 1711647776324\nInvalid JSON payload received. Unknown name \"registration_ids\" at 'message': Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "message.data[3].value",
"description": "Invalid value at 'message.data[3].value' (TYPE_STRING), 62"
},
{
"field": "message.data[7].value",
"description": "Invalid value at 'message.data[7].value' (TYPE_STRING), 1711647776324"
},
{
"field": "message",
"description": "Invalid JSON payload received. Unknown name \"registration_ids\" at 'message': Cannot find field."
}
]
}
]
}
}
2024-03-28 18:42:57.485 [AndroidPushFirebase] INFO - Android-Geraet(e) konnten nicht gepusht werden:{
"error": {