Hey,
I'm thinking this is a bug, but I'm not truly sure since this is my first time dabbling with push notifications.
On Android, while in the foreground, I get this error during the onMessageReceived event:
W/System.err( 2830): org.json.JSONException: No value for message
W/System.err( 2830): at org.json.JSONObject.get(JSONObject.java:389)
W/System.err( 2830): at org.json.JSONObject.getString(JSONObject.java:550)
My onMessageReceived looks like this:
notificationCallbackAndroid: (message, data, notification) => {
console.log("MESSAGE: " + JSON.stringify(message));
console.log("DATA: " + JSON.stringify(data));
}
While in the foreground, the message is always null, but data contains some actual data. The data parameter contains the following:
{
"foreground": true,
"custom-key1": "custom-value1",
"custom-key2": "custom-value2"
}
It contains all my custom key-value pairs, but not the actual message that was sent. For clarity, I am using FCM which I believe is the only option now, but honestly I'm not sure.
I've confirmed that in the background, I do in fact receive a notification in the tray. However, it is still useful to receive the message in the foreground.
Please let me know.
NativeScript 2.5.4
Android 5.1.1
macOS Sierra
Thanks,
Hey,
I'm thinking this is a bug, but I'm not truly sure since this is my first time dabbling with push notifications.
On Android, while in the foreground, I get this error during the
onMessageReceivedevent:My
onMessageReceivedlooks like this:While in the foreground, the
messageis always null, butdatacontains some actual data. Thedataparameter contains the following:It contains all my custom key-value pairs, but not the actual message that was sent. For clarity, I am using FCM which I believe is the only option now, but honestly I'm not sure.
I've confirmed that in the background, I do in fact receive a notification in the tray. However, it is still useful to receive the message in the foreground.
Please let me know.
NativeScript 2.5.4
Android 5.1.1
macOS Sierra
Thanks,