Page 1 of 1

Push notification handling with app is closed and/or in background

Posted: Wed Sep 07, 2016 2:57 am
by tcbeaton

Is there any way to have appery app handle push notifications, even when the app is closed and/or in the background without causing an alert to the user?

I'm looking to have push notifications sent silently to the appery app, to have the app update information which would not need an audible or visual alert to the user, the information would simply be stored and displayed within the app when they next view the app.


Push notification handling with app is closed and/or in background

Posted: Wed Sep 07, 2016 9:44 am
by Illya Stepanov

Hello Thomas,

When the app is closed the push message received by the device system automatically if the push notifications are enabled in the system preferences.

I'm not sure if this is possible to send silent push messages this should be configured on the platform system side. And I'm not sure that this is available for hybrid apps out-of-the-box this is something that should be developed custom for a specific platform.


Push notification handling with app is closed and/or in background

Posted: Fri Sep 09, 2016 2:51 am
by tcbeaton

Do you think it might be possible to use the Cordova Background Plugin to accomplish this?

There is a route tracking example of the Background Plugin at:

https://blog.appery.io/2015/12/how-to...

Thoughts?


Push notification handling with app is closed and/or in background

Posted: Fri Sep 09, 2016 8:42 pm
by Serhii Kulibaba

Hello,

Yes, you can use this plugin for that functionality


Push notification handling with app is closed and/or in background

Posted: Sun Sep 11, 2016 2:55 am
by tcbeaton

I'm still having issues with this. Please see my code in the reply below, and hopefully, you might have some advice.


Push notification handling with app is closed and/or in background

Posted: Sun Sep 11, 2016 3:00 am
by tcbeaton

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.


Push notification handling with app is closed and/or in background

Posted: Mon Sep 12, 2016 1:22 pm
by Serhii Kulibaba

Unfortunately this is something outside the scope of standard Appery.io platform support. You may consider purchasing Advisory Pack to get more in-depth help on this question. Here is more information about Advisory Pack (http://appery.io/services/#Advisory_Pack).


Push notification handling with app is closed and/or in background

Posted: Fri Sep 30, 2016 12:17 pm
by Logan

Hi Thomas.

Have you solved this issue?

Regards.


Push notification handling with app is closed and/or in background

Posted: Tue Oct 11, 2016 12:31 am
by tcbeaton

Hi Logan, Sorry for the delay in responding, things have been busy. I have not solved this issue. Nearest I can tell from the research I 've done on this topic is that while the app is in the foreground (active app) the app can trap the incoming push message and process it accordingly. While the app is in the background, the push notification displays a card or pop-up triggered by the OS, which then will also be processed when the app has been brought to the foreground. My (still unaccomplished goal is to have the app trap and process the push notification behind the scenes in all cases.