0
アプリがバックグラウンドで実行されている場合、onNotificationイベントをトリガーしようとしています。イオンプッシュ通知アプリがバックグラウンドにある場合にonNotificationイベントをトリガする方法は?
は、私はこの方法でそれを実行しようとしました:あまりにもプッシュ要求で1:
$ionicPush.init({
"canShowAlert": true, //Can pushes show an alert on your screen?
"canSetBadge": true, //Can pushes update app icon badges?
"canPlaySound": true, //Can notifications play a sound?
"canRunActionsOnWake": true, //Can run actions outside the app,
"debug": true,
"onNotification": function (notification) {
console.log("onNotification");
var payload = notification.payload;
console.log(notification);
var title = "SmartCam mobile";
var message = $translate.instant('Cam') + " : " + $translate.instant(payload.eventType) + " " + $translate.instant("registered at") + " " + payload.time;
notificationService.showNotification(title, message, payload);
},
"onRegister": function (data) {
console.log("onRegister");
console.log(data.token);
localStorageService.set("STORED_VALUES_PUSH_TOKEN", data.token);
localStorageService.set("STORED_VALUES_PLATFORM", ionic.Platform.platform().toLowerCase());
}
});
Aは属性content_availableを使用
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer xyz" -d '
{
"tokens": ["abc"],
"profile": "smartcam",
"notification": {
"title": "Push sssTitle",
"message": "Push sotification body",
"content_available": 1,
"payload": {
"baz": "boo"
},
"android": {
"title": "Hey",
"message": "Hello Android!",
"content_available": 1,
"payload": {
"baz": "boo"
}
},
"ios": {
"title": "Howdy",
"message": "Hello iOS!",
"content_available": 1,
"payload": {
"baz": "boo"
}
}
}
}' "https://api.ionic.io/push/notifications"
しかし、運なし。
アプリがバックグラウンドで実行されている場合、このイベントを発生させるにはどうすればよいですか?
アドバイスをいただきありがとうございます。