You can open any map stored in any mobile map package, that was created by any of the following workflows:
- Take a map offline - preplanned—Provides a mobile map package directory.
- Take a map offline - on-demand—Provides a mobile map package directory.
- Take a map offline - ArcGIS Pro—Provides a mobile map package file (.mmpk).
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.
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:
- 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.
- 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.
- 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:
- Load the mobile map package.
- Read the expiration property on the mobile map package.
- Confirm that the mobile map package has not expired.
- Get the expiration date.
- 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.
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.
After you have loaded and opened the mobile map package, you can continue to work with the maps and follow these steps:
- Display and interact with the maps, layers, and data offline. Explore and edit the feature data, if necessary.
- Update an offline map by synchronizing your edits with the online services when connectivity is restored.
- Finish using an offline map to unregister any geodatabases and fully release all locks on the mobile map package.