Deploy local offline data with your app

There are two main workflows you can use to deploy offline data. One option is to copy your data to a known location on your device and use the AppStudio Framework to determine the storage location. The second option is to bundle your data as a Qt resource within the app and copy the data out to a known location once the app is installed onto the device. This topic outlines the steps for each of these workflows.

Manually deploy data with your app

To manually deploy data to your device, follow these steps:

  1. Author your TPKs, geodatabases, offline locators, and offline network datasets in ArcGIS Pro.
  2. When you reference these files in QML code, refer to the relative location where your data will be stored.
    import ArcGIS.AppFramework 1.0
    property string localTPK: AppFramework.userHomePath + "/ArcGIS/Runtime/data/Topographic.tpk"
  3. Before building your app, in the Settings tool accessible in the side panel, choose to enable External Storage on the Capabilities tab.
  4. Using a file explorer app, copy the data to the specified data location.

    Each operating system has a similar but slightly different data location as follows:

    • Android: Android/data/<your_app>/files/ArcGIS/Runtime/Data.
    • iOS: <your_app>/Documents/ArcGIS/Runtime/Data.
    • macOS: ~/ArcGIS/Runtime/Data.
    • Windows: %userprofile%\ArcGIS\Runtime\Data.
    • Ubuntu: $HOME/ArcGIS/Runtime/Data.

  5. By ensuring data is stored in these locations, and using the AppFramework.userHomeFolder function, you can be sure that your app can read and write data on any deployed operating system.


    If you're using an iOS device, you must use an iOS file browser app. On macOS version 10.15 Catalina or later, you can use Finder as a file browser. On earlier versions of macOS, or on Windows, you can use iTunes or another file browser app.

Bundle your data as a Qt resource

Although Qt supports reading from embedded resources, Esri's underlying Runtime Core does not, as it relies on standard C I/O, which doesn't support Qt resources. This means that you can bundle your offline data with your app for deployment, but you'll need to copy the data from the embedded resource to a physical location on the device. The AppStudio Framework contains a copyFile function that copies files from the embedded resource file to a physical location.

To bundle your data with your app, do the following:

  1. Add a JavaScript function to your app that uses the copyFile function and returns the path to your output data.
  2. Set the path property of your component equal to the JavaScript function that performs the copy.

    When your app launches, it executes the copyFile function, and the component that uses the local data loads properly.

  3. Before building your app, in the side panel, go to Settings > Capabilities, and enable External Storage.

The following code demonstrates copying data from the embedded resource to a physical location. You must add the source file (in this sample, Topographic.tpk) to your project, in a subfolder named Data, for this code sample to work.

import QtQuick 2.7
import QtQuick.Controls 2.1
import ArcGIS.AppFramework 1.0
import Esri.ArcGISRuntime 100.8

App {
    id: app
    width: 640 * AppFramework.displayScaleFactor
    height: 480 * AppFramework.displayScaleFactor

    property string fileName: "Topographic.tpk"
    property FileFolder sourceFolder: app.folder.folder("Data")
    property FileFolder destFolder: AppFramework.userHomeFolder.folder("ArcGIS/Runtime/Data")
    property string destPath: destFolder.filePath(fileName)
    property url destUrl: destFolder.fileUrl(fileName)

    function copyLocalData() {
        sourceFolder.copyFile(fileName, destPath);
        return destUrl;

    MapView {
        anchors.fill: parent

        Map {
            Basemap {
                ArcGISTiledLayer {
                    url: copyLocalData()

The output location of this example for each platform is the same as what's listed in the Manually deploy data with your app section above. This workflow works best with smaller files (for example, small geodatabases or TPKs); for performance reasons, it is not recommended for large datasets.