Overview
Offline Mode allows a UnifyApps Mobile App to continue operating when the device loses network connectivity. Pages render from a local cache, read data sources serve their last-fetched responses, and any form submissions or write operations performed while offline are queued locally and replayed against the backend when the connection is restored.
Offline Mode is particularly important for field-worker apps, logistics apps, and any mobile experience where users operate in locations with unreliable network coverage — warehouses, construction sites, remote field locations, or underground facilities.
Warning: Offline Mode is available for Mobile App types only. Web Apps running in a browser do not support Offline Mode. Copilot Chat and Display app types are also not supported.
Enabling Offline Mode
Follow these steps to turn on Offline Mode for a Mobile App:
Open Builder Settings: With your Mobile App open in the Application Builder, click the gear icon in the top bar to open Builder Settings.
Navigate to Mobile settings: In the settings panel, select Mobile. This section is only visible for Mobile App types.
Enable Offline Mode: Toggle Enable Offline Mode to on. Additional offline configuration options appear below the toggle.
Configure offline pages: In the Offline Pages field, select the pages that should be pre-cached on first app load. Users can navigate these pages while offline. Pages not in this list may not render correctly offline if their assets have not been cached during a previous online visit.
Set data source cache TTLs: For each read data source on your offline pages, open the data source configuration and set the Cache TTL (time-to-live). This determines how long cached data is considered fresh. See Configuration Reference for TTL guidance.
Choose a sync strategy: Select the Sync Strategy for queued writes. The strategy controls when queued offline writes are replayed once connectivity is restored.
Save and publish: Click Save in Builder Settings, then publish the app. Offline Mode takes effect in the published mobile app — it is not active in the Builder's in-browser Preview.
What Works Offline
When the device has no network connection and Offline Mode is enabled, the following capabilities remain available:
| Capability | Offline Behavior |
| Page rendering | Pages listed in offlinePages render from the local asset cache. Navigation between these pages works normally. |
| Read data sources | Data sources with a configured cacheTTL serve their last-fetched response from the local cache. The data is as fresh as the last successful network fetch. |
| Form submissions (writes) | Create, update, and delete operations triggered while offline are saved to a local write queue. They are replayed when connectivity returns. |
| App variables and state | In-memory variables continue to work normally. State set before going offline is preserved. |
| Local navigation actions | Navigate actions, Set Variable actions, and Show Snackbar actions that do not require a network call work normally. |
What Does NOT Work Offline
The following capabilities require a network connection and are unavailable when the device is offline:
| Capability | Offline Behavior | Mitigation |
| Real-time data | Live data subscriptions (Pusher, Realtime Events) stop updating. The last received value is shown until connectivity returns. | Show the offline banner so users know data may be stale. |
| File uploads | File upload components cannot push files to a remote storage backend. Files selected while offline are not queued — they must be re-selected and uploaded after connectivity returns. | Disable file upload components while offline using {{app.isOffline}}. |
| Auth token refresh | If the user's authentication token expires while offline, they may be redirected to the login screen on next app open. The app cannot refresh tokens without a network connection. | Configure long-lived tokens or silent refresh on reconnect for field-worker apps. |
| Third-party integrations | Integrations that make outbound network calls (Yellow.ai, Pusher, CleverTap, etc.) stop functioning. | Show degraded-mode notices for features that depend on these integrations. |
| Non-cached pages | Pages not listed in offlinePages may fail to render if not previously cached by the device. | Add all critical pages to offlinePages. |
| Data sources without cache TTL | Data sources with no TTL configured do not cache responses and return empty offline. | Set a TTL on every read data source used on offline pages. |
Configuration Reference
The following settings control Offline Mode behavior. All are found in Builder Settings → Mobile.
| Setting | Type | Description |
cacheTTL | number (seconds) | Per data source. How long the cached response is served before it is considered stale. A stale cache is still served offline but is refreshed on the next online data fetch. Set to 0 to disable caching for a specific data source (it will return empty offline). |
offlinePages | string[] | Array of page IDs to pre-cache on first app load. These pages and their assets are downloaded and stored locally so they render without a network connection. Pages not in this list will only render offline if they were visited and cached during a previous online session. |
syncStrategy | immediate | manual | background | Controls how queued offline writes are replayed when connectivity returns. immediate: writes replay the moment the network is detected. manual: a sync button or action must be triggered by the user. background: writes replay silently in the background without blocking the UI. |
Recommended Cache TTL Values
The right TTL depends on how frequently your data changes and how stale data impacts your users' work:
Reference data (product catalogs, location lists, technician directories): 24 hours (86,400 seconds) or longer.
Work queues and job lists: 15–60 minutes (900–3,600 seconds), depending on how quickly new assignments are issued.
Status and metrics: 5–15 minutes (300–900 seconds). Stale metrics are less harmful than stale work assignments.
Real-time operational data: do not cache (TTL = 0) — show an offline notice instead.
Offline Indicator
UnifyApps exposes the device's connectivity state through the binding {{app.isOffline}}. This boolean is true when the device has no network connection and false when it is online. Use it to show an offline banner, disable write-heavy actions, or display stale-data notices.
Example: Offline Banner
Add a full-width banner block to the top of your layout. Set its Visible property to {{app.isOffline}}. The banner appears automatically when the device goes offline and disappears when connectivity is restored:
// Banner component Visible binding {{app.isOffline}} // Banner label text "You are offline. Showing cached data. Changes will sync when you reconnect."
Disabling Write Actions While Offline
For operations you do not want queued (for example, file uploads or payment actions), disable the button using a visibility or disabled binding:
// Button Disabled binding {{app.isOffline}} // Or conditionally show a different message {{app.isOffline ? "Uploads unavailable offline" : "Upload Photo"}}
Sync and Conflict Resolution
When the device reconnects, queued writes are replayed against the backend. The order of replay follows the order in which writes were queued — oldest first.
How Sync Works
The mobile shell detects network connectivity (or the user triggers manual sync, depending on the
syncStrategysetting).Queued write operations are dequeued in order and executed against their respective data source endpoints.
Each write either succeeds or fails. Successful writes are removed from the queue. Failed writes are retried up to three times before being flagged as failed.
On completion, the app dispatches an
OnSyncCompleteevent that you can listen to for triggering a data refresh or showing a confirmation snackbar.
Conflict Resolution
Conflicts occur when a record was modified on the server while the user was offline and has also been modified in the offline queue. UnifyApps resolves conflicts using last-write-wins by default: the queued offline write is applied on top of any server-side change, overwriting it.
For scenarios where last-write-wins is unacceptable — such as inventory counts or financial tallies — you can implement custom merge logic using a data source transform function:
// Custom merge function on a write data source // Called during sync replay when the server returns a 409 Conflict function mergeOfflineWrite(serverRecord, offlinePayload) { return { ...serverRecord, // Merge specific fields rather than overwriting the whole record notes: [serverRecord.notes, offlinePayload.notes].filter(Boolean).join('\n'), lastModifiedBy: offlinePayload.lastModifiedBy, lastModifiedAt: offlinePayload.lastModifiedAt }; }
Note: Failed sync items appear in the Sync Log. Users can access the sync log via the app's offline sync status panel (accessible through {{app.syncLog}} in a binding or via the Control Offline Mode action). Failed items show the reason for failure and provide a retry option.
Control Offline Mode Action
The Control Offline Mode action is available in the action picker on any event. It provides programmatic control over offline mode behavior:
| Command | Effect |
forceOffline | Simulates an offline state on the device, even if a network connection is present. Useful for testing offline behavior in development without disabling Wi-Fi. |
forceOnline | Clears a forced offline state and restores normal connectivity detection. |
syncNow | Triggers an immediate sync of the offline write queue. Useful for the manual sync strategy — wire this to a "Sync" button in the UI. |
clearCache | Clears all locally cached data source responses. Useful for a "Refresh Data" action when the user knows their cache may be significantly stale. |
Frequently Asked Questions
What happens if a user's phone runs out of storage while queueing offline writes?
The mobile shell monitors available local storage before queuing a write. If available storage falls below a safe threshold (configurable, default 50 MB), the app displays a warning and declines to queue further writes until storage is freed. Existing queued writes are preserved. The user is shown a notification explaining the situation and prompted to free up device storage or sync existing queued items before making additional offline changes.
Can I selectively enable Offline Mode for only certain pages while keeping other pages online-only?
Yes. The offlinePages configuration controls which pages are pre-cached and therefore accessible offline. Pages not in the offlinePages list are not pre-cached and will only render offline if the user visited them during a previous online session and the assets happen to be in the device's browser cache. Additionally, individual data sources on any page can have their cacheTTL set to 0 to prevent caching — those data sources will return empty results offline, effectively making that page's data unavailable even if the page renders. This lets you fine-tune which pages offer a full offline experience versus a degraded or unavailable one.