I want send notification to specific user, i can get the id but when i try to send a notification to these id doesn't work. In android does not send either success or error notification, and ios send a "index.html null" notification.
The notifications arrive the same device from where I send them, none arrives at the device where I want to send them.
this is app.component.js:
let notificationOpenedCallback = function(jsonData) {
let alert =alertCtrl.create({
title: jsonData.notification.payload.title,
subTitle: jsonData.notification.payload.body,
buttons: ['OK']
});
alert.present();
console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
};
window["plugins"].OneSignal
.startInit("05d411f4-45da-4101-92a5-4a60e5c9fd03", "49543248748")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
});
and with this code i send de notification
window['plugins'].OneSignal.getIds(function(ids) {
let notificationObj = { contents: {"en": "Han hecho un nuevo pedido"},
heading: { "en": "Domi-Trustik" },
include_player_ids: [this.idadmin]
};
window['plugins'].OneSignal.postNotification(notificationObj,
function(successResponse) {
console.log("Notification Post Success:", successResponse);
alert("enviado:" + JSON.stringify(successResponse));
},
function (failedResponse) {
console.log("Notification Post Failed: ", failedResponse);
alert("error" + JSON.stringify(failedResponse));
}
);
});
Is in Ionic 2