Can I use the App platform PWA in a custom app to support offline use of the app?

Dear house, before I port to DHIS2 or partly using it with our existing system we have a PWA app that we use to capture data offline and it works fine in our case. I read that the app platform now support PWA although design mostly with the dashboard in mind. I want to ask if it is possible to deploy same approach for a custom app especially the cacheable sections feature.

I have enabled pwa for my app built with the platform app. The challenge we have now which we were not having with our previous app is that when the system logout a user or in area where network is poor, the user cannot login to access the app if there is no network.

Is it possible for a user to download the app like a normal PWA will be and use it when it cannot use the browser. I have design my app for data capturing offline 100%.

Can the PWA support users to download the app to their phone and use the downloaded manifest version even if they are logged out of the main DHIS2 instance?

Hi Jet,

Thanks for the question! I’m happy to hear you’re trying out the PWA features :slightly_smiling_face:

Currently our PWA system should indeed let the app be downloaded to the phone and support working offline. Cacheable sections are also available to custom apps, and you can read some documentation with examples at the App Runtime documentation: Cacheable Sections

As far as logging in and out, the current implementation of the offline tools are pretty basic, though we do intend to implement more sophisticated offline session handling in the future. The way it works currently, as long as the user doesn’t log out, the app should continue working while offline or with poor network. While offline, the user won’t need to log in (when their logged-in session expires), and they can continue using the app without the network.

Note that this means that the user should make sure to keep the device that’s logged in safe to prevent unauthorized access. In this current implementation, manually logging out clears data that’s cached offline, which can be used to secure data in case a device will be shared. In this case the user won’t be able to log in again until back online.

Our plan for the future is to encrypt the data cached offline at rest to increase security, and require users to authenticate with their username and password to access the app while offline in the same way that they would while online.

Hopefully this helps, and thanks for posting! Let us know if you have any more questions or feedback :slightly_smiling_face:


[quote=“Kai Vandivier, post:2, topic:49721, username:kpvandivier”]
Currently our PWA system should indeed let the app be downloaded to the phone and support working offline
[/quote]This is the part I am more interested in. In normal PWA experiencer like the app we were using, you will get a notofication once you open the app to install it. Most times our users do and are able to access the app offline even without network. But with the DHIS2 pwa custom app I develop, I didn’t get that invitation to install the app and try to use it offline.

1 Like

Ah interesting, thanks for bringing that to our attention! I’ve tested it out and I have reproduced the issue too. The app does continue to work offline in a browser though, at least – hopefully it does for you as well.

It is our intention that the app can be “installable” in that way on mobile devices, so there seems to be a bug happening. I made a Jira issue to report and track it: [LIBS-355] - Jira

Thanks for the feedback!

1 Like

Thanks @kpvandivier I will follow up on the Jira conversation.

1 Like