I have created a Javascript file in my project with the following code:
[quote:]
document.addEventListener('deviceready', function () {
cordova.plugins.backgroundMode.enable();
cordova.plugins.backgroundMode.onactivate = function() {
setInterval(function() {
console.log("bg mode");
},5000);
// I tried adding the following in "onactivate", but it doesn't seem to work as hoped
$(document).on("push-notification", function(event, data) {
Apperyio("pushLabel").text(data.message);
});
};
Code: Select all
cordova.plugins.backgroundMode.ondeactivate = function() {
console.log("fg mode");
};
},false);
$(document).on("push-notification", function(event, data) {
Apperyio("pushLabel").text(data.message);
});
[/quote]
I am hoping to be able to have my app capture and process the push notification message in the background without raising an alert. When the alert is in the foreground, the message is received and placed in "pushLabel", as expected. What I'm looking for is to see if I can also get the message placed in "pushLabel", without the alert being raised in the status bar, when the app is in the background.
Thanks for any assistance you may be able to offer.