Offline behavior is controlled in the Behavior > Offline & Sync pane.
AppSheet apps can be used on a mobile device even when that device is offline and disconnected from the network. This is possible because the information needed to run the app (the app definition, the data, and optionally images and documents) is stored locally on the mobile device. If you are running the app in a web browser, please read the information at the end of this article.
If you have security filters in your app, they allow you to partially sync the app with data in the spreadsheet.
Sync is the step that sends data updates from the device to the backend and retrieves the latest app definition and data from the backend to the device. If you choose Delayed Sync for your app, the app will not sync data immediately when an edit, delete, or add occurs. Rather, your changes will be queued up until you explicitly choose to sync. You should select this option for apps that are expected to work in offline environments or where you want to control when sync occurs. For example, you can use Delayed Sync to control when you use network data bandwidth.
Intermittent connectivity: Apps that don't enable Delayed Sync will attempt to synchronize changes every time that data changes on the device. However, even in a connected environment, there may be intermittent connectivity problems that prevent synchronization from succeeding. In this case, AppSheet automatically queues changes and defaults to delayed sync behavior to prevent the loss of data. Even repeated sync retries will not cause duplication or corruption of data, except for the special case where you use RowNumber as your key. For more information, see What is a key?
Viewing content offline: All spreadsheet/table data is automatically copied to the device so that it is available offline. However, images and documents are not copied to the device by default, because they may be large. You can enable Offline Content Caching to tell AppSheet to copy images and documents to the device. As with all other offline data caching, the images and documents are copied to the device when the app is initially run on the mobile device while online. The images and documents are refreshed as needed when Sync occurs. You can learn more about caching in this article: Where is my data cached?
Depending on the number and size of your images and documents, it may take several minutes for all of your content to be downloaded and saved on the device. Even if the images or documents are displayed by the client, this does not mean that the content has been downloaded and saved. When you first download the content, you should connect your device to the network, launch the application, and wait for a few minutes before disconnecting. Then go offline and check whether all of the images and documents have been downloaded and saved on the device. If not, reconnect and allow even more time for the images and documents to be downloaded and saved.
Note that offline content viewing of images and documents only works when the links to the images or documents use relative paths as described in Work with PDF files.
Maps and offline usage
It's possible to capture the user's current location with a LatLong input because this can use the device's GPS. However, you won't be able to display the position in the map view while the app is offline. We're unable to cache Google map data for offline use because it would violate Google's terms of service. Google's own Maps app does offer downloading of map regions for offline use, but unfortunately they don't make this feature available for third party apps that use maps.
Video is now a column type, but is currently unavailable offline. This column type is read-only and does not (currently) support data capture. However, you can use it to play video content. It supports MP4 video URLs or YouTube embed URLs of this format:
File-type columns are not stored locally at the moment, unlike images and other data. This is a potential future feature, though.
If you have used the lightweight deployment mechanism, you are familiar with launching apps from their home screen icons. By default, a mobile device needs to be online in order to launch an app from its home screen icon. Once launched, the app can then function offline or with intermittent connectivity.
However, if you wish to launch the app when the device is offline, you must go to the Behavior > Offline & Sync pane and set the Offline App Launch option. You must do this before installing the app on your device. If your app has already been installed to the home screen, the shortcut must be deleted and installed again after enabling the offline option. Otherwise you will need to launch it from the AppSheet app itself.
Prolonged offline use
You should not run for prolonged periods (multiple days or weeks) while completely offline and without connectivity. There are two reasons for this:
- The app creator may make modifications to the app definition, and the user's app falls out of date.
- There may be changes to the underlying data. If the offline app makes its own data changes, an eventual sync will apply the older updates at a much later time and override changes made by other users.
Offline with sign in
If your app requires sign-in, your users will occasionally be asked to sign in again when their authentication expires. This will only occur during a sync when the device has connectivity.
Run in a offline browser
Some customers choose to run the app in a web browser (fullscreen or in an iframe). This is particularly useful when running on mobile platforms like Windows Phone where the mobile app isn't supported.
The browser must be online when the AppSheet application is first loaded. Once the app is loaded, it can be used when the device is offline or has intermittent network connectivity. However, offline image and document caching will not work. You can keep working in this manner offline as long as the page isn't closed or unloaded. Saved changes will persist across page reloads or browser restarts for all data types except images or documents in a form. For images or documents, sync must be performed before that browser tab is closed-- otherwise, the captured image or document content will be lost.