Support Article
Clicking Push Notifications does not open work item
KCP-241
Summary
An application is enabled on a mobile device. When a work item is assigned to a user, Push notifications are sent to the mobile device. On click of the Push notification, the work item must open in the Review or Perform mode.
In Android devices, on click of the Push Notification, the work item does not open and the user is redirected to the Launch pad.
In iOS devices, on click of the Push Notification, the assignment opens instead of the work item.
Error Messages
Not Applicable
Steps to Reproduce
- Create an application with mobile support enabled.
- Send a Push Notification to a user when a case is assigned.
Root Cause
Push Notification handlers are initialized when 'launchbox' API becomes available. To achieve that, the Notifications API uses pega.mobile.hybrid.callWhenLaunchboxLoaded to register the callback which is invoked when the 'launchbox' is ready. The pega.mobile.hybrid.callWhenLaunchboxLoaded underneath, creates the window.onLaunchboxLoaded function which is invoked from the native code to notify the JavaScript that the 'launchbox' is initialized and ready for use. When the window.onLaunchboxLoaded is invoked, all the callbacks registered using pega.mobile.hybrid.callWhenLaunchboxLoaded are invoked as well, and ultimately the Push Notifications handlers are initialized.
In this case, Push Notifications handlers are not initialized and default handling occurred (simple popup is displayed to the user with the notification message and OK button).
The user overrode the below window.onLaunchBoxLoaded function (which should not be performed).
window.onload = function() { if (pega.mobile) { window.onLaunchboxLoaded = handleOpenAccount; } };
Resolution
Perform the following local-change:
Use the below function instead of overriding the onLaunchboxLoaded function.
function monitorLaunchboxLoaded() { if (pega.mobile && pega.mobile.hybrid) { pega.mobile.hybrid.callWhenLaunchboxLoaded(handleOpenAccount); } else { // pega.mobile.hybrid namespace may not be available yet. setTimeout(monitorLaunchboxLoaded, 50); } } monitorLaunchboxLoaded();
Published December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.