# Mobile packages

You can build applications that can display maps or scenes, geocode, and find routes without a network connection using mobile packages.

## What is a mobile package?

A mobile package contains one or more maps or scenes. It also contains data content that is referenced by layers in the maps or scenes. Mobile packages are used to display maps and scenes, geocode, reverse geocode, find routes and directions, and analyze data without a network connection.

There are two types of mobile package:

• Mobile map package (MMPK): This type of package contains maps.
• Mobile scene package (MSPK): This type of package contains scenes.

You use mobile packages to build offline applications that:

• Display interactive maps or scenes without a network connection.
• Distribute multiple maps or scenes to mobile workers.
• Geocode addresses and find places offline.
• Get nearby addresses (reverse geocode).
• Calculate turn-by-turn directions offline.
• Include maps and scenes with an application install.
• Distribute maps and scenes that cannot be used after a specific date and time.

You create a mobile package from desktop maps and scenes in ArcGIS Pro. A map or scene in a mobile package shares many capabilities of the desktop map or scene:

• Zoom, pan, and rotate the map or scene.
• Interact with the map's or scene's layers.
• Query and identify features in feature layers.
• Display popups as configured in the desktop map or scene.
• Control feature layer styling.
• Control the visible scale ranges for layers.

## How a mobile package works

A mobile package begins with an ArcGIS Pro project containing maps and/or scenes. ArcGIS Pro includes tools to:

• Package up maps and data into a mobile map package file of type .mmpk.
• Package up scenes and data into a mobile scene package file of type .mspk.

You can then sideload or download a mobile package to a device and use it without a network connection.

##### The typical steps to use a map or scene in a mobile package are:
1. Author an ArcGIS Pro project containing maps and/or scenes.
2. Create a mobile package using the appropriate ArcGIS Pro tool.
4. Access and display a map or scene from the mobile package.

This document will cover step 4. For steps 1-3, see the Create a mobile map package tutorial.

### Data content

Each map or scene contained in a mobile package can include basemap layers, data layers, and non-spatial tables. A mobile package can include different types of data to support the layers in the package's maps or scenes.

#### Offline content

A mobile package can include data content for layers and non-spatial tables. Layers in a mobile package's maps or scenes can use this data content without a network connection.

Data content can be included for the following layer types:

• Feature layer
• Vector tile layer
• Image tile layer

The data in a single mobile package can be shared across layers in multiple maps or scenes within that package. This can make mobile packages an efficient way to distribute multiple maps or scenes.

#### Online content

Layers in a mobile package's maps or scenes can opt to reference online services whenever a network connection is available. This is useful for including live data such as weather or traffic.

If a layer references an online service, it will only display content when there is a network connection. Data content for that layer is not included in the mobile package.

#### Geocoding, routing, and analysis data

Mobile packages can also contain data to support geocoding, routing, turn-by-turn directions, service area analysis, and closest facility analysis.

##### The typical steps to geocode using a mobile package are:
1. Author an ArcGIS Pro project containing maps and/or scenes, and at least one locator.
2. Create a mobile package using the appropriate ArcGIS Pro tool, including a locator. A mobile package can only include one locator, but it can be a composite locator combining multiple locators from the source ArcGIS Pro project.
4. Access the locator included in the mobile package.
##### The typical steps to find routes using a mobile package are:
1. Author an ArcGIS Pro project containing maps and/or scenes. At least one map/scene should include at least one transportation network dataset.
2. Create a mobile package using the appropriate ArcGIS Pro tool.
4. Access the map or scene in the mobile package that includes the transportation network dataset(s).
5. Access a Transportation Network Dataset from the map or scene to create a Route Task.
6. Use the Route Task to find a route and directions.

### Package expiry

Mobile packages support an expiry date and time. This can be a hard expiry, after which ArcGIS Maps SDKs for Native Apps will not open the mobile package, or a soft expiry after which the Native will issue a warning that an offline application can present to its user.

## Code examples

### Display a map from a mobile map package

1. Create a Mobile Map Package referencing a .mmpk file on disk.

3. Use one of the maps included in the mobile map package.

ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use dark colors for code blocksCopy

try
{
var mobileMapPackage = await MobileMapPackage.OpenAsync(path: "path\\to\\file.mmpk");
MainMapView.Map = mobileMapPackage.Maps.First();
}
catch(Exception ex)
{
// Handle error.
}

### Display a scene from a mobile scene package

1. Create a Mobile Scene Package referencing a .mspk file on disk.

3. Use one of the scenes included in the mobile scene package.

ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use dark colors for code blocksCopy

try
{
var mobileScenePackage = await MobileScenePackage.OpenAsync(path: "path\\to\\file.mspk");
MainSceneView.Scene = mobileScenePackage.Scenes.First();
}
catch(Exception ex)
{
// Handle error.
}

### Find an address using a mobile map package

1. Create a Mobile Map Package referencing a .mmpk file on disk.

3. Access the Locator Task provided by the Mobile Map Package to perform a geocode.

ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use dark colors for code blocksCopy

try
{
var mobileMapPackage = await MobileMapPackage.OpenAsync(path: "\\path\\to\\file.mmpk");

var geocodeResult = await locatorTask.GeocodeAsync("123 Fake Street, Springfield");

if (geocodeResult.FirstOrDefault()?.DisplayLocation is MapPoint resultLocation)
{
await MainMapView.SetViewpointCenterAsync(resultLocation);
}
}
catch (Exception ex)
{
// Handle error
}

### Find a route and directions using a mobile map package

1. Create a Mobile Map Package referencing a .mmpk file on disk.

3. Access and load a map which includes a Transportation Network Dataset, and create a Route Task.

4. Access the Route Task to find a route between two points and return turn-by-turn directions.

ArcGIS Maps SDK for .NETArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)
Use dark colors for code blocksCopy

try
{
var mobileMapPackage = await MobileMapPackage.OpenAsync(path: "\\path\\to\\file.mmpk");

if (mobileMapPackage.Maps.FirstOrDefault() is Map map)
{

if (map.TransportationNetworks.FirstOrDefault() is TransportationNetworkDataset networkDataset)
{

var startStop = new Stop(point: fromPoint);
var destinationStop = new Stop(point: toPoint);

routeParams.SetStops(new[] { startStop, destinationStop });
routeParams.ReturnDirections = true;

// Display the route results in a GraphicsOverlay
}
}
}
catch (Exception ex)
{
// Handle the error
}

APIs
Tools