我想通过OneSignal向我的Android应用发送通知,这段代码有什么问题吗?
他没有工作,我已经阅读了所有文档,并且不知道我需要做什么。
window.plugins.OneSignal.getIds(function(ids) {
var notificationObj = { contents: {en: "message body"},
include_player_ids: [ids.userId]};
window.plugins.OneSignal.postNotification(notificationObj,
function(successResponse) {
console.log("Notification Post Success:", successResponse);
},
function (failedResponse) {
console.log("Notification Post Failed: ", failedResponse);
alert("Notification Post Failed:\n" + JSON.stringify(failedResponse));
}
);
});