Notifications not showing up while Native Mobile App is already open

0
I’ve implemented the Push Notifications module and managed to get the notifications to show up when the app is minimized and is in the background. But when I send the message while the app is still open, nothing happens. The Push Notifications Message tab says the message is successfully delivered. Is it possible to get it work the same way for when the app is in the foreground as when the app is in the background? If so, how can I achieve that?
asked
6 answers
0

Hi Kevin,

The mobile OS’s will not allow us to show a notification for an opened app that is in the foreground. It is your responsibility as a developer to catch notification and display it inline in a proper way. 

See tutorial how to handle this

https://docs.mendix.com/howto/mobile/native-remote-notifications#4-2-push-notifications-for-an-app-in-the-foreground

Cheers, Andries

 

answered
1

Hi, we have exactly the same issue. The OnReceive handler seems not to be fired. We test it both under local and remote versions. I’m preparing the exact reproduce steps right now.

answered
0

Hi Andries,

I see...That is a bummer... But I'm still confused, I've configured the OnLoad and OnReceive nanoflows for the Push Notifications widget. The OnLoad works fine when I send a test notification from the below page and tap the notification that appears in the background.

But when I do that while the app is open, my OnReceive nanoflow doesn’t seem to do anything. The OnReceive I’ve implemented has a “Log Message” and “Show Message” but it doesn’t trigger. So I thought the notification/message wasn’t sent successfully. But in the Messages tab, it says that the status was “Delivered” as seen in the screenshot below.

 

Not too sure what I’m missing here...

answered
0

Did you match the “ActionName" from the widget, matches the action name you send from the server?

sendProductOnReceive

prepareMessageData

answered
0

Hi Andries,

Yea I did. The OnOpen nanoflow for the ActionName works but the OnReceive nanoflow doesn’t get triggered for the same ActionName.

Also what’s that microflow in your last image? The “Send” button microflow doesn’t have the “PrepareMessageData” sub-microflow. Is that needed? Mine just looks like the image below:

answered
0

Update:
I noticed I have left out a key piece of code to add into the Android manifest file during the Native Push Notification setup. Specifically, in section 4.3 of this documentation : https://docs.mendix.com/howto/mobile/setting-up-native-push-notifications#customize-android-manifest

Can’t believe I missed that. Upon making these changes to the Android manifest file I am able to trigger my OnReceive nanoflow while the app is open when sending a test message.

Hope this can help anyone that may be having the same issue as well. I had to learn this the hard way and start from scratch.

answered