AnsweredAssumed Answered

ExportTileCacheJob never starts

Question asked by Dendroyka on Feb 15, 2017
Latest reply on Feb 27, 2017 by Dendroyka

I'm using the .Net runtime sdk (v.100) for Xamarin Android. I'm trying to download tiles as a .tpk for offline use by my mobile app.

 

I've managed to use the AuthenticationManager to give me a token for my app. I can successfully create the ExportTileCacheTask and create the ExportTileCacheJob by calling ExportTileCache on the ExportTileCacheTask, but the status of the job never seems to change. When I check the job status immediately after the call to ExportTileCache, it is "NotStarted" and the ServerId = "". I have a breakpoint on my ExportJob_JobChanged handler and it never gets hit no matter how long I wait.

 

Any ideas? Code below:

 

var serviceUri = new Uri("https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Imagery/MapServer");
var tokenUri = new Uri("https://www.arcgis.com/sharing/rest");

try
{
var serverInfo = new ServerInfo
{
ServerUri = tokenUri,
TokenAuthenticationType = TokenAuthenticationType.OAuthClientCredentials,
OAuthClientInfo = new OAuthClientInfo { ClientId = MYCLIENTID, ClientSecret = MYCLIENTSECRET) },
};

AuthenticationManager.Current.RegisterServer(serverInfo);

var cred = await AuthenticationManager.Current.GenerateCredentialAsync(tokenUri, new GenerateTokenOptions { });

var exportTask = await ExportTileCacheTask.CreateAsync(serviceUri, cred);

 

 

var exportParams = await exportTask.CreateDefaultExportTileCacheParametersAsync(aoi, 50000, 10000);

 

job = exportTask.ExportTileCache(exportParams, localFilePath);

job.JobChanged += ExportJob_JobChanged;
}
catch (Exception e)
{
e.ToString();
}

Outcomes