It send greatly to player id that I specific on mobile device.
but not on web…which I Command"ionic serve" I want send notification to mobile device from web.
It get error saying TypeError: Cannot read property ‘OneSignal’ of undefined at new HomePage
I console.logged it and found that window[“plugins”] is undefined.
how can I solve this problem to send notification on web.
I’m using ionic because by making once, I can use it web, ios, android…
I think there should be a way to solve it…but can’t find it.
window["plugins"].OneSignal
.startInit("xxx", "ccccc")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
var notificationObj = { contents: {en: "testtest"},
include_player_ids: [my player id]};
window["plugins"].OneSignal.postNotification(notificationObj,
function(successResponse) {
},
function (failedResponse) {
alert("Notification Post Failed:\n" + JSON.stringify(failedResponse));
}
);