Closed Akash0333 closed 3 years ago
@Akash0333 I just added a test for mutableContent
being set correctly and it works as expected.
It works with either mutableContent: 1
or mutableContent: true
.
The test can be found here: https://github.com/appfeel/node-pushnotifications/commit/f6b0da2c4f4a15bc2dd2fbfb703569b1be436b47
Hope this helps? Maybe your problem is caused by something else entirely?
which kay do I need to use mutableContent: true OR mutable_content: true?
mutableContent: true
or mutableContent: 1
both work
@Akash0333 I just added a test for
mutableContent
being set correctly and it works as expected. It works with eithermutableContent: 1
ormutableContent: true
. The test can be found here: f6b0da2Hope this helps? Maybe your problem is caused by something else entirely?
please share your code snippet, facing same issue
@kanji-ngi My code snippet is the test I referenced and it asserts that the node-apn message object includes mutable-content: true
.
Could you share your code and/or logs or some form of output showing the constructed apns message?
@alex-friedl coming from @kanji-ngi I have put this mutableContent :1 in camel case for my nodeJs project below is source code
Source code:
send: function (request_data, device_id, message, callback) {
console.log("request_data.user_id", request_data.user_id);
if (request_data.user_id != undefined) {
let selectQuery = SELECT count(tbl_notification.id) as notificaion_count from tbl_notification WHERE is_read = 0 AND receiver_id = ? AND is_delete = 0
;
database.query(selectQuery, request_data.user_id, (_Err, _Res) => {
if (_Err) {
callback(false);
} else {
var pushPayload = {
topic: "com.sample.app",
alert: {
title: "title",
body: message.message,
},
sound: "default",
custom: {
title: "title",
body: message.message,
tag: message.notification_tag,
sender_id: message.sender_id,
},
};
if (message.device_type == "A") {
delete pushPayload.sound;
} else {
// pushed for IOS
pushPayload.title = "title";
pushPayload.body = message.message;
// this badge for show unread notification count of FR in IOS application ( home screen icon )
pushPayload.badge = _Res[0].notificaion_count;
pushPayload.mutableContent = 1; // apn
}
console.log(
"pushPayload in send FR notification handler",
pushPayload
);
var push = new node_push(this.setting);
push.send(device_id, pushPayload, (error, result) => {
console.log("push-notificaion error, result", error, result);
if (error) {
callback(false);
} else {
callback(true);
}
});
}
});
} else {
callback(false);
}
},
Here is my request log
pushPayload in send FR notification handler { topic: 'com.sample.app', alert: { title: 'title', body: 'Semantha Georrgie sent you a connection request.' }, sound: 'default', custom: { title: 'title', body: 'Semantha Georrgie sent you a connection request.', tag: 'send_friend_request', sender_id: '521' }, title: 'title', body: 'Semantha Georrgie sent you a connection request.', badge: 1, mutableContent: 1, launchImage: 'launch dummy img url', image: 'image url for android' }
This is the reponse of Push notification I have receiving on IOS device (apn), there is no mutable-content property available in apn response.
[AnyHashable("gcm.message_id"): 1592995598780445, AnyHashable("body"): Semantha Georrgie sent you a connection request., AnyHashable("tag"): send_friend_request, AnyHashable("title"): title, AnyHashable("google.c.sender.id"): 103189143344, AnyHashable("sender_id"): 521, AnyHashable("launchImage"): launch dummy img url, AnyHashable("aps"): { alert = { body = "Semantha Georrgie sent you a connection request."; title = title; }; badge = 1; sound = default; }, AnyHashable("msgcnt"): 1, AnyHashable("google.c.a.e"): 1, AnyHashable("message"): Semantha Georrgie sent you a connection request., AnyHashable("sound"): default]
Since the node-apn payload shows the correct property being set, I would assume this is either an issue with node-apn and/or the APNS API changed somehow?
Closed due to inactivity. Please re-open if issue persists
I am sending mutableContent:1 but still, IOS app getting mutableContent No. I have changed so many value and keys but still getting No
Any solution, please?