【发布时间】:2018-10-04 16:39:11
【问题描述】:
我正在尝试将 Ionic 应用中的事件发布到 PushWoosh 以显示应用内消息,但它不起作用。
docs 中有一个 Javascript 示例。我试过了:
pushNotification.postEvent(JSON.stringify({
"event": "Test event",
"attributes": {
"test": true,
},
"success": successCallback, // optional
"error": errorCallback // optional
}));
但是没有触发事件。
我查看了插件文件,界面对该方法的用法有不同的说明:
//Function: postEvent
//[android, ios] Post events for In-App Messages. This can trigger In-App message display as specified in Pushwoosh Control Panel.
//
//Parameters:
// "event" - event to trigger
// "attributes" - object with additional event attributes
//
// Example:
//(start code)
// pushwoosh.setUserId("XXXXXX");
// pushwoosh.postEvent("buttonPressed", { "buttonNumber" : 4, "buttonLabel" : "banner" });
//(end)
PushNotification.prototype.postEvent = function(event, attributes) {
exec(null, null, "PushNotification", "postEvent", [event, attributes]);
};
因此,我尝试了:
pushNotification.postEvent('Test event', {
"test": true
});
但它也不起作用。
所以,应用程序正在注册设备,推送通知也在工作,但我无法推送事件。 (在仪表板中,触发器计数为 0)。
有什么想法吗? 先谢谢了!!
【问题讨论】:
标签: android cordova ionic-framework cordova-plugins pushwoosh