Deploy local offline data
Your app may need data to be loaded onto your device rather that getting it from a service at the time it is needed. Taking your data offline allows you to access it without a network connection. The needed data may have been authored using ArcGIS Desktop and may include data from other sources. Three common workflows to deploy data your app can use offline are described in this topic.
To copy your data to the device, also known as sideloading, you use a tool to copy the data to a known location on the device before the app is used, and then you use the ArcGIS QML Extras plug-in to determine at run time where that location is.
To copy data to a device:
- Author your tile packages, geodatabases, offline locators, offline network datasets, or mobile map packages in ArcGIS Pro.
- Using a file explorer tool (for example, ADB/Android File Transfer for Android, macOS Finder for iOS, and the native file explorers for each desktop platform), copy the data to the specified data location.
- When you reference these files in QML code, use the ArcGIS Extras plug-in to refer to a location where the data will be stored relative to where your app resides on the device.
Each operating system has a similar but slightly different data location:
- Android location is
- iOS location is
- Mac location is
- Windows location is
- Linux location is
By storing data in these locations and using the
System.userHomePath property, you can be sure that your app will be able to read and write data on any deployed operating system.
When deploying to iOS, you must modify the
.plist file for the template provided with the SDK to enable file sharing with your app. Modify the
.plist file to change
TRUE. To use this functionality, plug in your device, open Finder on your macOS, select your device from the Locations section. Once your device is selected, select
Files, and all apps with file sharing enabled should be displayed. Find your app and drag and drop any files or folders into your app.
Although Qt supports reading from embedded resources, ArcGIS Runtime SDK uses standard C file I/O which does not support Qt resources. Therefore when you bundle your data with your app for deployment, you must copy the data from the Qt resource file (
.qrc file) to a working data location on the device before you can use it. The ArcGIS QML Extras plug-in contains a
copyFile function that copies files from the
.qrc file to a working data location.
This workflow is good for smaller data files such as small geodatabases or tile packages. For performance and app size reasons, this workflow is not recommended for large data files.
You can host your data on ArcGIS Online or ArcGIS Enterprise, and use the API to download the data as a portal item, storing it in a working data location. Use the ArcGIS Extras plug-in to refer to the working data location relative to where your app resides on the device. After downloading and storing the data locally, your app can access the data without a network connection.
Depending on your app's needs, you may need some additional data resources.
If your app is using grid-based transformations, deploy the required Projection Engine data files to the device by copying them (sideloading) or downloading them directly to the device.
If your application displays ENC layers, deploy the
hydrography directory, available in the download area (requires you to log in).