Hi Erel, the issue is that time_to_live works fine while delivery_receipt_requested is not recognised by Firebase server
Private Sub SendMessageToSingleDevice(Devtoken As String, datastring As String)
Dim Job As HttpJob
Job.Initialize("SendMessage", Me)
Dim m As Map = CreateMap("to": $"${Devtoken}"$)
Dim noti As Map = CreateMap("body":"Notification ", "title":"New message!")
Dim data As Map = CreateMap("data": datastring, "key": tokenstore, "tel": Starter.telefono)
m.Put("notification", noti)
m.Put("data", data)
m.Put("content_available": True)
m.Put("delivery_receipt_requested":True)
m.Put("time_to_live":600)
Dim jg As JSONGenerator
jg.Initialize(m)
Job.Tag=jg
Log(jg.ToString)
Job.PostString("https://fcm.googleapis.com/fcm/send", jg.ToString)
Job.GetRequest.SetContentType("application/json;charset=UTF-8")
Job.GetRequest.SetHeader("Authorization", "key=" & api_key)
End Sub
the log shows:
** Service (firebasemessaging) Start **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Activity (main) Pause, UserClosed = false **
{"content_available":true,"data":{"data":"sendgps","key":"diEXJxxm2Ac:APA91bE5qbnSQO1Je8HV-l24NKBhmUdVBPraU7DdMnjRFIKa_qCLPQ3zavUJQoHWxAqUkyk5NKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","tel":"34xxxxxxxxx,39"},"to":"diEXJxxm2Ac:APA91bE5qbnSQO1Jxxxxxxxxxxxxxx-l24NKBhmUdVBPraU7DdMnjRFIKa_qCLPQ3zavUJQoHWxAqUkyk5NKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","time_to_live":600,"notification":{"body":"Notification ","title":"New message!"},"delivery_receipt_requested":true}
** Activity (gps) Create, isFirst = true **
** Activity (gps) Resume **
Invalid field "delivery_receipt_requested"
[errormessage=Bad Request, httputils2service=null, jobname=SendMessage
, password=, req=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest@41780ed8, username=
, tag=anywheresoftware.b4a.objects.collections.JSONParser$JSONGenerator@4177e560, target=class it.whereami.logicdata.firebasemessaging, taskid=3
, success=false]
--------------------------------------------------------------------------
Red is the JSON sent, while
green message and answer below is the answer from the engine.
Ciao
Mauro