Honor mobile map package expiration date
Access the expiration information of an expired mobile map package.
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.
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.
- Create a
MobileMapPackagepassing in the path to the mobile map package's location on the device.
- Load the mobile map package.
Expirationinformation to the user with:
Expiration.Messageto get the expiration message set by the author of the MMPK.
Expiration.DateTimeto get the expiration date set by the author of the MMPK.
The mobile map package is available in ArcGIS Online. The map shows rivers in Scotland with unique annotation.
<ContentPage x:Class="ArcGISRuntimeXamarin.Samples.HonorMobileMapPackageExpiration.HonorMobileMapPackageExpiration" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <esriUI:MapView x:Name="MyMapView" Grid.Row="0" Grid.RowSpan="2" /> <Grid Grid.Row="0" BackgroundColor="DarkGray"> <Label x:Name="ExpirationLabel" Margin="5" Text="Map package not expired." TextColor="White" /> </Grid> </Grid> </ContentPage>