Bonjour,
Voila je rencontre un petit problème avec mon code.
Je voudrais que lorsque j'envois des notifications, ceux-ci s'assemble pour en former qu'un (un peu comme hangout):
Je me suis aidé de ces 2 lien pour réaliser mon code:
http://docs.ionic.io/docs/push-sending-push
https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md
J'aimerai obtenir ceci:
<a href="http://www.hostingpics.net/viewer.php?id=425758Sanstitre4.png"><img src="http://img15.hostingpics.net/thumbs/mini_425758Sanstitre4.png" alt="Heberger image" /></a>
Décrivez ici votre code ou ce que vous cherchez à faire
voici mon code:
dans mon app.js:
var push = new Ionic.Push({
"debug": true,
"onNotification": function (notification) {
var payload = notification.payload;
},
"onRegister": function (data) {
console.log(data.token);
},
"pluginConfig": {
"ios": {
"badge": true,
"sound": true
},
"android": {
"icon": "ic_logo",
"iconColor": "#ee9425",
"style": "inbox",
"summaryText": "vous avez reçu %n% notification",
"payload": {
"style": "inbox",
"summaryText": "vous avez reçu %n% notification"
},
//"Collapse Key": "message",
"sound": true
}
}
});
/* push.on('notification', function (data) {
console.log(data.message);
});*/
push.register(function (token) {
console.log("Device token:", token.token);
$localStorage.token = token.token;
push.saveToken(token); // persist the token in the Ionic Platform
});
et voici ma fontion d'envoie des notifications:
var messagePush = val.content;
var titlePush = val .toName;
var req = {
method: 'POST',
url: 'https://api.ionic.io/push/notifications',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + jwt
},
data: {
"tokens": val.token,
"profile": 'profile',
"notification": {
"title": titlePush,
"message": messagePush,
"android": {
// "notId": "1",
"icon": "ic_logo",
"iconColor": "#ee9425",
"image": val.image,
/* "payload": {
"style": "inbox",
"summaryText": "vous avez reçu %n% notification"
},
"style": "inbox",
"summaryText": "There are %n% notifications",*/
"stack": 3,
"data": {
"style": "inbox",
"summaryInbox": "inbox",
"notId": Math.floor((Math.random() * 100) + 1)
},
"payload": {
"custom_app_thing": "yes"
},
"title": titlePush,
"message": messagePush
},
"ios": {
"title": titlePush,
"message": messagePush
}
}
}
};
// Make the API call
$http(req).success(function (resp) {
// Handle success
console.log("Ionic Push: Push success", resp);
var refmypush = ref.child('push').child(snapshot.key());
refmypush.remove();
}).error(function (error) {
// Handle error
console.log("Ionic Push: Push error", error);
});
Voilà ce que j'obtiens <a href="http://www.hostingpics.net/viewer.php?id=338235Sanstitre3.png"><img src="http://img15.hostingpics.net/thumbs/mini_338235Sanstitre3.png" alt="Heberger image" /></a>