Download progress TileCacheTask

2218
3
01-13-2014 04:32 AM
BeateHöller
New Contributor II
Hi,

when downloading map tiles with TileCacheTask it would be useful to show information about the download progress.
Is it possible to predict the probable file size of the data? Also information about the size of already downloaded data would be interesting.

Greets,
bbbb9999
0 Kudos
3 Replies
BeateHöller
New Contributor II
And how to pause or kill the task?
0 Kudos
by Anonymous User
Not applicable
I agree this would be incredibly useful.  Anyone figure out a way to do this?  I am tying to get a Notification that shows the percentage downloaded on Android.
0 Kudos
BeateHöller
New Contributor II
Hey Aaron,

i could answer my question myself. Actually everything expected is easily possible.
But up to now it is not working quite well, maybe because the TileCacheTask class has still beta status.

You can get the progress in percent and the estimated time left as follows:

CallbackListener<TileCacheStatus> statusCallback = new CallbackListener<TileCacheStatus>(){


      public void onCallback(TileCacheStatus tcs) {
       for(GPMessage message : tcs.getJobResource().getMessages()){
        System.out.println(message.getDescription());
        System.out.println(message.getType());
       }
      }


      public void onError(Throwable e) {
       // TODO Auto-generated method stub
       
      }
      
     };


The Messages contain the expected information for you.
You can cancel the Task as follows:

new TileCacheTask(serviceUrl, creds).submitTileCacheJobAndDownload(params, statusCallback, downloadCallback, filename).cancel(true);


Hope this helps you, greets!
0 Kudos