Honor mobile map package expiration date

View inMAUIUWPWPFWinUIView on GitHub

Access the expiration information of an expired mobile map package.

Honor mobile map package expiration date

Use case

The data contained within a mobile map package (MMPK) may only be relevant for a fixed period of time. Using ArcGIS Pro, the author of an MMPK can set an expiration date to ensure the user is aware the data is out of date.

As long as the author of an MMPK has set an expiration date, the expiration date can be read even if the MMPK has not yet expired. For example, developers could also use this API to warn app users that an MMPK may be expiring soon.

How to use the sample

Load the sample. The author of the MMPK used in this sample chose to set the MMPK's map as still readable, even if it's expired. The sample presents expiration information to the user.

How it works

  1. Create a MobileMapPackage passing in the path to the mobile map package's location on the device.
  2. Load the mobile map package.
  3. Present Expiration information to the user with:
  • Use Expiration.Message to get the expiration message set by the author of the MMPK.
  • Use Expiration.DateTime to get the expiration date set by the author of the MMPK.

Relevant API

  • Expiration
  • MobileMapPackage

Offline Data

The mobile map package is available in ArcGIS Online. The map shows rivers in Scotland with unique annotation.

Tags

expiration, mmpk

Sample Code

HonorMobileMapPackageExpiration.xamlHonorMobileMapPackageExpiration.xamlHonorMobileMapPackageExpiration.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<UserControl
    x:Class="ArcGIS.UWP.Samples.HonorMobileMapPackageExpiration.HonorMobileMapPackageExpiration"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <TextBlock
                x:Name="ExpirationLabel"
                Text="Map package not expired."
                TextWrapping="Wrap" />
        </Border>
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.