Skip To Content ArcGIS for Developers Sign In Dashboard

Open an offline map

You can open any map stored in any mobile map package, that was created by any of the following workflows:

If you created the mobile map package with ArcGIS Pro, you may need to consider whether the mobile map package content has expired. If not, proceed to open the offline map.

Handle expired mobile map packages

Using ArcGIS Pro 2.4 (or later), you can control the lifetime of your maps by setting an expiration date on your mobile map package. This will allow you to do the following:

  • Provide data to third-party contractors that will expire at the end of a contract.
  • Indicate to your users that the data has become obsolete.
When you use the ArcGIS Pro tool to create the mobile map package, you can set an expiration date and time, an expiration message, and access options if the package has expired.

Note:

These mobile map package expiration properties are available if ArcGIS Pro is licensed with the ArcGIS Publisher extension.

As an ArcGIS Runtime developer, there are three possible outcomes when you try to load a mobile map package:

  1. You have full access to the mobile map package. This situation occurs if the mobile map package has not expired or if it has been created without any expiration properties.
  2. You have full access to the mobile map package even though the maps and their data have expired. You will be warned that the mobile map package is out of date.
  3. You cannot access the mobile map package because it has expired. In this case, the mobile map package will fail to load and you will not be able to access its maps and data.

These three outcomes are managed by the mobile map package load process AGSMobileMapPackage.load. No extra workflow or code paths are required to accommodate this expiration.

If you want to provide your users with extra information, you can retrieve the expiration details from the expiration property on the AGSMobileMapPackage. For example, you can display how many days remain before the mobile map package expires. To do this, perform the following steps:

  1. Load the mobile map package.
  2. Read the expiration property on the mobile map package.
  3. Confirm that the mobile map package has not expired.
  4. Get the expiration date.
  5. Calculate the number of days between today and the expiration date. Report the number of days remaining.

Open the offline map

You can open the map directly from a mobile map package file (created by ArcGIS Pro) or from a mobile map package directory (created by the preplanned or on-demand workflows). To create the mobile map package object, pass the mobile map package file path or directory to the AGSMobileMapPackage constructor. Load the mobile map package and access its collection of maps. Passing the map to the map view will initiate loading the map, its layers, and data.

Note:

If the mobile map package was created with ArcGIS Pro 2.6 (or later) it may contain online layers or tables. If so, then your app may need to handle authentication before the layers and tables are loaded.

After loading the map, its metadata is accessible using the AGSMap.item property. In some situations, you may want to access the metadata from the mobile map package without loading the map itself. You can access this from the MobileMapPackage.item property.

See Display a map for more details on how to access and display maps stored in mobile map packages.

Next steps

After you have loaded and opened the mobile map package, you can continue to work with the maps and follow these steps:

  1. Display and interact with the maps, layers, and data offline. Explore and edit the feature data, if necessary.
  2. Update an offline map by synchronizing your edits with the online services when connectivity is restored.
  3. Finish using an offline map to unregister any geodatabases and fully release all locks on the mobile map package.