Dim ps As PushRecord
ps=Main.KvsPushDb.Get(nr.DeviceID)
Dim ex As Map
ex.Initialize
ex.Put("Firmware", nr.Firmware)
ex.Put("Vid", nr.Vid)
ex.Put("field1", "field1")
ex.Put("Field2",100)
Dim data As Map = CreateMap("title": nr.Title, "body": nr.Text, "extra": Mysub.maptostring(ex))
If ps.DeviceType=Main.TYPE_IOS Then
Dim message As Map = CreateMap("topic": nr.DeviceID, "data": data)
Dim iosalert As Map=CreateMap("title": nr.Title, "body": nr.Text)
ps.CurrentBadge=ps.CurrentBadge+1
Main.KvsPushDb.Put(nr.DeviceID,ps)
Dim Aps As Map=CreateMap("badge": ps.CurrentBadge)
If nr.sound<>"NoSound" Then Aps.put("sound", nr.Sound)
Dim PayLoad As Map=CreateMap("aps": Aps)
Dim Apns As Map=CreateMap("headers": CreateMap("apns-priority": "10"), "payload": PayLoad)
message.Put("notification", iosalert)
message.Put("apns", Apns)
Dim nn As String="IOS_" & shortid & ", Badge " & ps.CurrentBadge & ", sound: " & nr.sound & ", Title: " & nr.title & ", Msg: " & nr.Text
Else
If nr.sound<>"NoSound" Then data.put("sound", nr.Sound)
Dim message As Map = CreateMap("topic": nr.DeviceID, "data": data)
message.Put("android", CreateMap("priority": "high"))
Dim nn As String="AND" & Mysub.Right(nr.DeviceID,5) & ", Badge " & ps.CurrentBadge & ", sound: " & nr.sound & ", Title: " & nr.title & ", Msg: " & nr.Text
End If
FirebaseSendMessage(message, nn)
End Sub