Skip to Content

How to Build an Offline App

Introduction

An offline app is a Vinyl app that can run on an iOS or Android mobile device without a network connection. Offline apps are useful in cases where users have limited or intermittent internet connections.

An offline app needs a core Vinyl app to synchronize with. The core app is a fully featured Vinyl app, while the offline version is generally a stripped-down version of the core app. The offline and core apps have similar but separate databases, sources, logic, and pages.

Synchronization between the two apps is done with Vinyl Connectors.

Important

Synchronization cannot be automated and must be initiated by the user when there is a stable internet connection.

Offline app user authentication is done via the core app, and is described in Offline App Authentication.

Prerequisites

To build and deploy an offline Vinyl app, you need the following:

  • Vinyl version 3.3.34390+.

  • An iOS or Android mobile device.

  • An app complete and ready for go-live in all aspects, including branding, privacy policy covering the deployment jurisdictions, terms and conditions for the user to accept or decline, and other features commonly associated with mobile apps offered through app stores.

  • An administrator account for the deployment app store (Apple App Store or Google Play Store), and the necessary store configuration to allow publication of the app.

Build Your Core App

Follow our best practices for an app development workflow to build your core app as a normal, fully featured Vinyl app that can connect to third-party systems and resources.

Tables and business rules (logic) that should be accessible in the offline app must have both Read and Write Public Access enabled. It is recommended that you create a dedicated offline Role for these tables and business objects.

Users logging into the offline app on their mobile devices are authenticated via the core app's security provider.

Two security tokens are involved in user authentication:

  1. A session token, which authenticates a user's access to an offline app. (This token corresponds to a non-mobile Vinyl app's session token.) Session tokens have a default expiry time of two weeks. They are renewed, while the user continues to use the offline app, when less than half of the expiry period remains.

  2. A remote token, which authenticates a user's access to the core app and its public tables. Remote tokens have a default expiry time of one hour. Once expired, the user must re-authenticate with the core app, but this happens automatically if the user queries a remote table in the offline app.

    Tip

    Since the expiry time for remote tokens cannot be changed, you should consider developing your offline app so that it communicates with the core app soon after user authentication, and before the remote token expires.

Build Your Offline App

Use the following guidelines to build your offline app as a lightweight, stripped-down version of the core app, with only the minimum essential tables, columns, pages, logic, or resources necessary for it to work:

  • Data and sources

    • Use Vinyl's copy feature to copy essential tables from your core app database to the offline app database.

    • Review the copied tables and remove any non-essential columns.

    • Add the core app as a Vinyl Connector data source.

    • Use the connector to import the tables and business objects the offline app needs.

    • Check all tables in the Vinyl Connector have both Read and Write Public Access enabled.

    • Check there are no internet-dependent resources, such as the following:

      • REST API endpoints

      • Widgets that use third-party services

      • Themes with fonts or other internet-based assets

  • Core-to-offline synchronization

    • Create an XP CRUD rule to pull data from the Vinyl Connector to your offline app database.

    • Add a button (for example, Pull data from core app) that calls this rule.

  • Offline-to-core synchronization

    • Create another XP CRUD rule to push data from the offline app database to the core app (via the Vinyl Connector).

    • Add another button (for example, Push data to core app) that calls this CRUD rule.

    • To synchronize only changed records, use the Audit Lite fields AddedOn and ChangedOn, or add a column that gets set when a row changes, and reset when synchronized.

    • To alert the user that an internet connection is available, or to enable and disable the synchronization buttons, use the runtime function system(networkstatus).

Deploy Your Offline App

When your offline app is ready, Jitterbit Support deploys the application to the Apple App Store (iOS) or the Google Play Store (Android), from where users can download it onto their mobile devices.

In contrast to the core app, which you release yourself, if you change the offline app it must be redeployed by Jitterbit Support,

Limitations

Before you start building your offline app, you should be aware of their following limitations:

  • An offline app's database is erased when the app is upgraded.

  • Synchronizing a large number of records (10,000 or more) can take a long time.

  • Background schedules do not run when the Vinyl app on the mobile device is closed.