Hello everybody.
Using “plugin.notifications.v2” with FCM on iOS device and the following code to send a notification to specific devices :
sendNotification = function (pToken, pMessage) local jsonMessage if (pToken ~= "unknown") then jsonMessage = [[{ "registration\_ids": ["]] .. tostring (pToken) .. [["], "data": { "alert": "]] .. pMessage .. [[", } }]] -- Send the push notification local url = "https://fcm.googleapis.com/fcm/send" local parameters = { headers = { ["Authorization"] = "key=" .. "MyKeyAuthorization", ["Content-Type"] = "application/json", }, body = jsonMessage, } network.request(url, "POST", onSendNotification, parameters) end end
Now, I want to send custom data. But cannot figure out how to put it in the variable jsonMessage.
Next thing also is how to handle the custom data in the notification listener (event.custom [1] ?)
Any examples will be of great help.