How can we allow users to view a PDF or image within an app while offline?
We have a PDF of guidelines and would like the app users to be able to view this PDF while in the app, yet a good portion of the time the user, and thus the device and app, will be offline.
There are several options, and which route you take depends on how many PDFs or images (files) you need to have access to offline.
For a small number of files - either convert them to images or HTML and upload them to your app’s asset’s folder and then you can display them in app using <display-image /> or <html /> components
For a larger number of files (#1) - store the files in a Fileshare application (like Dropbox), ensure end users have access to those files offline and then store the links to those files in the JourneyApps DB. End users will then open the files through the links
For a larger number of files (#2) - convert the files to base64, store them in the DB in a text field and use a custom HTML component and our JourneyApps iFrame client (also known as HTML Bridge) to display the base64 data. (Please note, storing large amounts of image / pdf data in base64 can have performance implications and should usually be stored on a dedicated DB model)
If users are online then you can simply store the files in the JourneyApps DB as attachments and display them using <display-photo /> or <display-file /> components - however this is only 100% reliable if the user is online as the attachments are only cached offline for a short period of time.