We have a Xamarin.Forms app that allows users to specify a basemap and offline-capable feature layers. The basemap and layers are then taken offline. The basemaps that we are allowing our users to pick from are the Esri created basemaps "For Export". Found here - http://www.arcgis.com/home/search.html?q=for%20export&t=content&focus=layers&start=1&sortOrder=desc&sortField=relevance
So the problem: We have the ExportTileCacheTask being created based on which basemap the user chooses. The job then creates the .tpk file and stores it on the device. The problem is when the user navigates to the page where the MapView and the Map are created. The .tpk gets loaded into a Basemap layer from the device, but always throws a "No Data" error. This is happening specifically with the Topographic and Streets basemaps, but we have it working with the Imagery basemap. We can't identify any differences between these basemaps, and the code always runs the same regardless of which basemap is chosen. Here is some of our code:
var portalItem = await PortalItem.CreateAsync(new Uri(BASEMAP_BASEURL + mapConfig.SelectedBasemap.ID));
var task = await ExportTileCacheTask.CreateAsync(portalItem.ServiceUrl, cred);
var areaOfInterest = currentView;
var minScale = task.ServiceInfo.MinScale;
var maxScale = task.ServiceInfo.MaxScale;
var parameters = await task.CreateDefaultExportTileCacheParametersAsync(areaOfInterest, minScale, maxScale);
var path = AppSettings.TPKFilePath;
var job = task.ExportTileCache(parameters, path);
var tileCache = await job.GetResultAsync();
Note that the job.Status always returns a JobStatus.Succeeded. We immediately check the resulting tileCache, and it results in a "No Data" error.
Pulling .tpk out and into the MapView:
TileCache tileCache = new TileCache(AppSettings.TPKFilePath);
//Always states "No Data"
ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tileCache);
myMapView.Map.Basemap = new Basemap(tiledLayer);
If we remove the Try/Catch and don't .LoadAsync() the tileCache, the MapView becomes empty. Even the other operational layers we add after the basemap become empty. Whereas the Imagery basemap loads just fine. So the question is: why won't other basemaps work the same way? Thanks for any help in advance!