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?