Skip to content

Commit 5446425

Browse files
committed
Add onBackgroundPushReceived method
1 parent d3e4916 commit 5446425

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

Example/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
console.log("onPushReceived: " + JSON.stringify(event))
3535
})
3636

37+
Airship.push.onBackgroundPushReceived(function(event) {
38+
console.log("onBackgroundPushReceived: " + JSON.stringify(event))
39+
})
40+
3741
Airship.push.onNotificationResponse(function(event) {
3842
console.log("onNotificationResponse: " + JSON.stringify(event))
3943
})

cordova-airship/types/index.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,16 @@ export interface AirshipPush {
10821082
callback: (event: PushReceivedEvent) => void
10831083
): Cancellable
10841084

1085+
/**
1086+
* Background push received listener.
1087+
*
1088+
* @param callback The callback.
1089+
* @return A cancellable that can be used to cancel the listener.
1090+
*/
1091+
onBackgroundPushReceived(
1092+
callback: (event: PushReceivedEvent) => void
1093+
): Cancellable
1094+
10851095
/**
10861096
* Notification response listener.
10871097
*

cordova-airship/www/Airship.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ airship.push.onPushReceived = function (callback) {
377377
return registerListener("airship.event.push_received", callback)
378378
}
379379

380+
airship.push.onBackgroundPushReceived = function (callback) {
381+
argscheck.checkArgs('F', 'Airship.push.onBackgroundPushReceived', arguments)
382+
return registerListener("airship.event.background_push_received", callback)
383+
}
384+
380385
airship.push.onNotificationResponse = function (callback) {
381386
argscheck.checkArgs('F', 'Airship.push.onNotificationResponse', arguments)
382387
return registerListener("airship.event.notification_response", callback)

0 commit comments

Comments
 (0)