APEX PWA Push Notifications in just a few minutes

APEX PWA Push Notifications in just a few minutes

APEX 23.1 has just become available on apex.oracle.com, and one of its great features is the declarative push notifications for PWA apps. We can now enable push notifications without any further installation, simply by enabling them within an app.

What is PWA?

Progressive Web Apps (PWAs) are web applications that utilize modern web technologies to deliver an app-like experience to users. PWAs are installable, work offline, and have other features that enhance user experience, such as push notifications.

What are Push Notifications?

Push notifications are messages sent to users even when the app is not open or active. These notifications help increase user engagement and provide timely updates.

Now let's create app!

  1. On APEX page designer click on create and select new application.

  2. Make sure to check Install Progressive Web App and Push Notifications

That will create a new app and the first thing to notice is the settings menu item on the navigation bar

When we click that a drawer modal dialog page opens with the following option

Push notifications need to be enabled by each user. It works like that to respect user privacy and preferences. By explicitly enabling push notifications, users grant the application permission to send them notifications. This ensures that users have control over the information they receive and can opt-out if they feel overwhelmed or uninterested.

  1. Create a page process to send the notification. I am going to send this notification to a user called DEMO.

  1. Create a Button to submit the page and call the process we just created.

  2. The application is ready to send notifications. We only need to install it on the phone. To do so, open the application on your preferred browser (refer to the browser compatibility list below) and click on the Install app link in the navigation bar after logging in. (Make sure you log in with the same user from the application process) Follow the instructions provided to complete the installation process.

    1. Now let's enable push notifications for the logged user.

      1. If we click the button that we created in Step 4, it will initiate the page process and send the notification. Although it may take a few seconds to arrive, it works perfectly. I have tested on both Android and iOS, but for iOS, I need to upgrade my phone as the notifications only work on version 16.4.1 or higher.

We can also send the notifications using a new apex_pwa API.

    apex_pwa.send_push_notification (
    p_application_id => 112046,
    p_user_name      => 'DEMO',
    p_title          => 'My APEX APP Notification',
    p_body           => 'Testing the Push Notifications' );

Did you find this article valuable?

Support Rodrigo Mesquita by becoming a sponsor. Any amount is appreciated!