Unlock the Power of Oracle APEX: Building a PWA with Dual Screen/Window Capability
Image by Wellburn - hkhazo.biz.id

Unlock the Power of Oracle APEX: Building a PWA with Dual Screen/Window Capability

Posted on

Are you tired of building applications that are limited to a single screen or window? Do you want to take your Oracle APEX development to the next level? Look no further! In this article, we’ll explore the exciting world of Progressive Web Apps (PWAs) and show you how to build a dual screen/window capable application using Oracle APEX.

What is a PWA?

A Progressive Web App (PWA) is a web application that uses modern web technologies to provide a native app-like experience to users. PWAs are built using HTML, CSS, and JavaScript, and can be installed on a user’s device, allowing for offline access and push notifications.

Why Build a PWA with Oracle APEX?

  • Enhanced User Experience: PWAs provide a seamless and engaging user experience, making it ideal for complex applications.
  • Offline Capability: Users can access your application even when they don’t have an internet connection.
  • Push Notifications: Engage with your users by sending push notifications, even when they’re not actively using your application.
  • Installability: Users can install your PWA on their device, making it easily accessible and providing a native app-like experience.
  • Cost-Effective: Building a PWA with Oracle APEX eliminates the need for separate native apps for different platforms.

Building a Dual Screen/Window PWA with Oracle APEX

To build a dual screen/window PWA with Oracle APEX, we’ll follow these steps:

  1. Create a new Oracle APEX application.
  2. Design the user interface (UI) for the primary screen.
  3. Design the UI for the secondary screen.
  4. Implement the logic for the primary screen.
  5. Implement the logic for the secondary screen.
  6. Configure the PWA settings.
  7. Test and deploy the application.

Step 1: Create a new Oracle APEX application

Log in to your Oracle APEX instance and create a new application. Choose the “Desktop” or “Mobile” template, depending on your requirements.

Application Name: My PWA App

Template: Desktop

Theme: Universal Theme

Schema: MY_SCHEMA

Step 2: Design the UI for the primary screen

Create a new page for the primary screen. Add the necessary regions, items, and buttons to design the UI. For this example, we’ll create a simple form with two input fields and a submit button.

Page Name: Primary Screen

Page Type: Normal Page

Region: primary_screen_region

Items:

- P1_NAME (Text Field)

- P1_EMAIL (Email Field)

Button: SUBMIT

Step 3: Design the UI for the secondary screen

Create a new page for the secondary screen. Add the necessary regions, items, and buttons to design the UI. For this example, we’ll create a simple dashboard with a chart and a grid.

Page Name: Secondary Screen

Page Type: Normal Page

Region: secondary_screen_region

Items:

- CHART (Chart Region)

- GRID (Interactive Grid)

Step 4: Implement the logic for the primary screen

Create a new process to handle the form submission on the primary screen. For this example, we’ll simply display a success message.

Process Name: Handle Form Submission

Process Type: AJAX

Code:

begin

apex_application.g_print_success_message('Form submitted successfully.');

end;

Step 5: Implement the logic for the secondary screen

Create a new process to handle the chart and grid data on the secondary screen. For this example, we’ll simply display some sample data.

Process Name: Handle Chart and Grid Data

Process Type: On Load

Code:

begin

-- Initialize chart data

apex_chart.add_series(

p_series_name => 'Series 1',

p_x_axis=> apex_util.string_to_table('Jan, Feb, Mar'),

p_y_axis=> apex_util.string_to_table('10, 20, 30') );

-- Initialize grid data

for i in 1..10 loop

insert into my_table (id, name, email)

values (i, 'User ' || i, 'user' || i || '@example.com');

end loop;

end;

Step 6: Configure the PWA settings

In the Oracle APEX application settings, navigate to the “Progressive Web App” section. Enable the PWA feature and configure the necessary settings.

PWA Enabled: Yes

Start URL: f?p=MY_APP:PRIMARY_SCREEN:

Scope: My PWA App

Icons:

- 192x192 icon

- 512x512 icon

Step 7: Test and deploy the application

Test the application on different devices and browsers to ensure it’s working as expected. Deploy the application to your production environment.

Adding Dual Screen/Window Capability

To add dual screen/window capability to our PWA, we’ll use the Oracle APEX `apex.window` API. This API provides a set of functions for working with windows and screens.

apex.window.openWindow(

'SECONDARY_SCREEN',

'f?p=MY_APP:SECONDARY_SCREEN:',

'_blank',

null,

null,

true );

This code opens the secondary screen in a new window when the user clicks a button on the primary screen.

Handling Window and Screen Events

To handle window and screen events, we can use the Oracle APEX `apex.window` API. For example, we can use the `apex.window.addEventListener` function to listen for the `windowopened` event.

apex.window.addEventListener(

'windowopened',

function(event) {

// Handle window opened event

});

Conclusion

In this article, we explored the world of Oracle APEX PWAs and learned how to build a dual screen/window capable application. By following these steps and using the Oracle APEX `apex.window` API, you can create engaging and interactive PWAs that provide an enhanced user experience.

Remember to test and deploy your application to ensure it’s working as expected. Happy building!

Oracle APEX Version Compatibility
19.1 and above Supported
Below 19.1 Not Supported

Note: The Oracle APEX `apex.window` API is only available in Oracle APEX 19.1 and above.

This article is for educational purposes only and is not intended to be used in production environments without proper testing and validation.

I hope you enjoyed this article! If you have any questions or need further assistance, please don’t hesitate to ask.

Happy coding!

Frequently Asked Questions

Get ready to unravel the mysteries of Oracle APEX PWA Dual Screen/Window!

What is Oracle APEX PWA Dual Screen/Window, and how does it revolutionize my application?

Oracle APEX PWA Dual Screen/Window is a game-changing feature that allows you to create stunning, dual-screen experiences for your Progressive Web App (PWA) users. With this feature, you can design two separate screens or windows that work in tandem, enabling a seamless and engaging user experience. Imagine being able to display a list of items on one screen and their corresponding details on the other – it’s a whole new level of interactive storytelling!

How do I optimize my Oracle APEX PWA Dual Screen/Window for different devices and screen sizes?

Optimizing your PWA for different devices and screen sizes is a breeze with Oracle APEX! By using responsive design principles and APEX’s built-in features, such as conditional layout and media queries, you can ensure that your dual-screen experience adapts perfectly to various devices, from smartphones to desktops. Plus, APEX’s automatic scaling and layout adjustments will have your app looking sharp and stunning on any screen size!

Can I use Oracle APEX PWA Dual Screen/Window with other APEX features, like interactive grids and charts?

Absolutely! Oracle APEX PWA Dual Screen/Window plays nicely with other APEX features, such as interactive grids, charts, and more. Imagine displaying a chart on one screen and its underlying data on the other – it’s a match made in heaven! By combining these features, you can create a rich, immersive experience that will leave your users in awe.

How does Oracle APEX PWA Dual Screen/Window impact my application’s performance and security?

Oracle APEX PWA Dual Screen/Window is designed with performance and security in mind. Since it’s built on top of APEX’s robust platform, you can rest assured that your app will be lightning-fast and secure. Plus, APEX’s automatic caching and optimization features will minimize the load on your servers, ensuring a seamless user experience.

Are there any limitations or restrictions when using Oracle APEX PWA Dual Screen/Window?

While Oracle APEX PWA Dual Screen/Window offers incredible flexibility, there are some limitations to keep in mind. For example, dual-screen support might not be available on older browsers or devices with limited screen real estate. However, APEX’s built-in compatibility checks and automatic fallbacks will ensure that your app remains accessible and usable on a wide range of devices.