Warning |
---|
|
Please note that on android foreground push open will not be shown |
Step 1 - Listen to "deviceready" event(iOS only)
Code Block |
---|
language | js |
---|
title | add event listener |
---|
|
document.addEventListener('deviceready', this.onDeviceReady, false); |
...
step2 :Listen
...
toresumeevent and activate it explicitly for the first time(iOS only)
Code Block |
---|
language | js |
---|
title | add event listener |
---|
|
onDeviceReady: function() {
onResume();
document.addEventListener("resume", onResume, false);
app.receivedEvent('deviceready');
console.log('Received Event: ' + id);
}, |
Step 3 - implement the onResume function(iOS only)
When application is resumed the following code will check if it was due to push notification. if so feel free to extract the relevant custom field from the payload
Code Block |
---|
language | js |
---|
title | add event listener |
---|
|
function onResume() {
AppoxeePluginMappPlugin.getLastPushPayload(function (json) {
var jsonString = JSON.stringify(json);
if (jsonString && jsonString.length > 2) {
alert("Last Push Payload: " + jsonString);
}
});
} |
...