Mobile Map Package Doesn't Load

521
1
11-17-2021 09:10 AM
IsaacBevis
New Contributor

Hello,

I am trying to make an app for IOS and Android using the ArcGIS .net SDK (version 100.12.0) that would show users local trails, descriptions, points of interest, etc.  But my mobile map package will not load.  I found from an old post somewhere this code that downloads a mobile map package:

        // ItemId is the item's identifier on ArcGIS Online
        private async Task<string> GetData(string itemId)
        {
            // Create the portal
            var portal = await ArcGISPortal.CreateAsync().ConfigureAwait(false);

            // Create the portal item
            var item = await PortalItem.CreateAsync(portal, itemId).ConfigureAwait(false);

            // Create the data folder
            var fileLoc = Path.Combine(GetDataFolder(), "Data");
            if (!Directory.Exists(fileLoc))
            {
                Directory.CreateDirectory(fileLoc);
            }


            // Get the full path to the specific file
            fileLoc = Path.Combine(fileLoc, itemId);

            // Download the file
            using (var s = await item.GetDataAsync().ConfigureAwait(false))
            {
                using (var f = File.Create(fileLoc))
                {
                    await s.CopyToAsync(f).ConfigureAwait(false);
                }
            }

            return fileLoc;
        }

Then after I download the map I open the .mmpk file using MobileMapPackage.OpenAsync(filepath) and LoadAsync() methods.  I have tested this code with a few different maps and it seems to work for small map sizes but my mmpk file remains blank when you try to load it.  Could this be an issue in my code or rather how I packaged the .mmpk file?

0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor

> but my mmpk file remains blank when you try to load it.

Can you explain what you mean by "blank" ? Is the file not downloading, is the mmpk not containing any maps, are the maps that are in it not able to load (and if so what error are you getting?), do the map have layers in it after load, or do it all look fine but you just see blank rendered map on the mapview, do any of the layers fail to load (and if so again with what error)?

0 Kudos