如何检测何时收到通知
How detect when received a notification
我需要知道检测通知的功能。我可以发送和接收通知,但我需要一个功能来检测何时收到通知。
notificationOpenedCallback
将在打开通知或在应用处于焦点状态时收到通知时触发。示例如下。
var notificationOpenedCallback = function(jsonData) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
window.plugins.OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
{googleProjectNumber: "703322744261"},
notificationOpenedCallback);
没有关于何时通过 Corodva 在后台接收通知的事件。您将需要为此使用本机代码,方法是按照 Android 的 OneSignal Background Data and Notification Overriding 文档在 Java 中设置 NotificationExtenderService
。对于 iOS,将 content_available
设置为 true 并设置一个
- application:didReceiveRemoteNotification:fetchCompletionHandler: 选择器。
我需要知道检测通知的功能。我可以发送和接收通知,但我需要一个功能来检测何时收到通知。
notificationOpenedCallback
将在打开通知或在应用处于焦点状态时收到通知时触发。示例如下。
var notificationOpenedCallback = function(jsonData) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
window.plugins.OneSignal.init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
{googleProjectNumber: "703322744261"},
notificationOpenedCallback);
没有关于何时通过 Corodva 在后台接收通知的事件。您将需要为此使用本机代码,方法是按照 Android 的 OneSignal Background Data and Notification Overriding 文档在 Java 中设置 NotificationExtenderService
。对于 iOS,将 content_available
设置为 true 并设置一个
- application:didReceiveRemoteNotification:fetchCompletionHandler: 选择器。