Deploy local offline data with your app

There are two main workflows you can use to deploy offline data authored from ArcGIS for Desktop. 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 for Desktop.
  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 (for example, ADB/Android File Transfer for Android, iTunes for iOS, or native file explorers for each desktop platform), copy the data to the specified data location.
  5. Each operating system has a similar but slightly different data location as follows:
    • Android:/sdcard/ArcGIS/Runtime/Data.
    • iOS: <your_app>/Documents/ArcGIS/Runtime/Data.
    • Mac: ~/ArcGIS/Runtime/Data.
    • Windows: %userprofile%\ArcGIS\Runtime\Data.
    • Linux: $HOME/ArcGIS/Runtime/Data.

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


    For iOS, plug in your device, open iTunes, click your iPhone or iPad, click Apps, and scroll down to the bottom. Find your app, and use the Add dialog box to add your data. If you're using folders, make sure to create a clone of the structure you want, and add the topmost folder. This will copy everything to your app's Documents folder. For more information on the iOS data storage pattern, see the ArcGIS Runtime SDK for iOS guide.

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 will execute the copyFile function, and the component that utilizes the local data will load 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. Be aware that you need to 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.