It does work cause you did not set a correct target. If no target is set you get the push to all your devices. THAT´s happening here.a working example
THIS works (tested pushes to one specific device and also send a push to a contact)...
B4X:
Sub Button1_Click
Dim json As JSONGenerator
'--data-binary '{"type": "note", "title": "Note Title", "body": "Note Body"}'
If Main.aktdest.ContainsKey("email") Then
' Map contains key email
' -> It is a CONTACT
json.Initialize(CreateMap("email": Main.aktdest.Get("email") ,"type": "note", "title": subject.Text, "body": body.Text))
Label1.Text = "Contact: "&Main.aktdest.Get("name")
End If
If Main.aktdest.ContainsKey("manufacturer") Then
' Map contains key manufacturer
' -> It is a DEVICE
json.Initialize(CreateMap("device_iden": Main.aktdest.Get("iden") ,"type": "note", "title": subject.Text, "body": body.Text))
Label1.Text = "Device: "&Main.aktdest.Get("nickname")
End If
Dim job As HttpJob
job.Initialize("ME",Me)
job.Poststring(Main.PBpushes,json.ToString)
job.GetRequest.SetHeader("Authorization", "Bearer "&Main.secret)
job.GetRequest.SetHeader("Content-Type", "application/json")
End Sub