[BackgroundMode Plugin] How to display push notifications while app is in background?

[BackgroundMode Plugin] How to display push notifications while app is in background?

  
Forge Component
(0)
Published on 2016-12-16 by Alexandre Costa
0 votes
Published on 2016-12-16 by Alexandre Costa

Hi,

I've got the One Signal push notification app to work. I get notifications whether the app is open or not, but I can only display them in a list in my app when the app is open. Meaning the notification received event of the One Signal plugin is only being triggered when the app is open. So my eye fell on this plugin. The background plugin is available and I can enable the background mode when I login, but still the received event isn't being triggered when the app isn't open. Should I use the IsEnabled and IsActive client actions of the background plugin in the notification received handler of the One Signal plugin or do something with the Configure client action of the background plugin? I'm a bit stuck ;)

Thanks,

Artuur

Artuur De Maeyer wrote:

Hi,

I've got the One Signal push notification app to work. I get notifications whether the app is open or not, but I can only display them in a list in my app when the app is open. Meaning the notification received event of the One Signal plugin is only being triggered when the app is open. So my eye fell on this plugin. The background plugin is available and I can enable the background mode when I login, but still the received event isn't being triggered when the app isn't open. Should I use the IsEnabled and IsActive client actions of the background plugin in the notification received handler of the One Signal plugin or do something with the Configure client action of the background plugin? I'm a bit stuck ;)

Thanks,

Artuur

Hi Artuur,

I had a similar problem with notifications while app was closed. In my case I was not using OneSignal, but a custom version of Google Cloud Messaging Plugin.

May I ask what is the device manufacturer where you're not receiving those notifications?


Cheers

Nonetheless, for people that might be facing a similar problem here's an article that explains the Huawei notification problem that I was facing.

http://www.forbes.com/sites/bensin/2016/07/04/push-notifications-not-coming-through-to-your-huawei-phone-heres-how-to-fix-it/

Cheers

Hi Miguel,

Sorry for the late reply. I'm testing this on an iPhone, the article is a good read though. Did you use the background plugin in the end? If so: what did you use from it? I had a look at the demo and also enabled the background mode on application ready which doesn't give any errors. The 'scheculer' JavaScript isn't relevant, since it just runs every 10 seconds to create a log with the current time or updates notifications. But when you don't have access to the notification, that isn't useful in my case (I want a sort of inbox for the notifications). The config android block from the background plugin I shouldn't need either, since I'm testing this on an iPhone. I only have access to the notification when the 'OnNotificationReceived' event from the one signal plugin is triggered, which is not the case for some reason when I close the app and send a notification. I'm not in low power mode, so the background app refresh options is enabled.

Thanks in advance,

Artuur