RoboSpice RequestProgressListener updates progress states but progress itself stays at 0

StackOverflow https://stackoverflow.com/questions/17924385

  •  04-06-2022
  •  | 
  •  

Question

Greets

I'm using RequestProgressListener in MyRequestListener like this:

@Override
public void onRequestProgressUpdate(RequestProgress progress) {
    Log.d(LOG_TAG, "Progress update: " + progress.getProgress());
}

I see in logs that RequestProcessor changes states but progress update constantly shows 0.

D//RequestProcessor.java:358(1391): 10:49:39.346 Thread-117 Sending progress PENDING
V//RequestProcessor.java:481(1391): 10:49:39.392 main Notifying 1 listeners of progress com.octo.android.robospice.request.listener.RequestProgress@41356ad0
I//MyRequestListener(1391): Progress update: 0.0
D//RequestProcessor.java:358(1391): 10:49:39.459 Thread-119 Sending progress READING_FROM_CACHE
V//RequestProcessor.java:481(1391): 10:49:39.472 main Notifying 1 listeners of progress com.octo.android.robospice.request.listener.RequestProgress@412e3a68
I//MyRequestListener(1391): Progress update: 0.0
D//RequestProcessor.java:358(1391): 10:49:39.538 Thread-119 Sending progress LOADING_FROM_NETWORK
V//RequestProcessor.java:481(1391): 10:49:39.546 main Notifying 1 listeners of progress com.octo.android.robospice.request.listener.RequestProgress@41294d88
I//MyRequestListener(1391): Progress update: 0.0
D//RequestProcessor.java:358(1391): 10:49:39.757 Thread-119 Sending progress WRITING_TO_CACHE
V//RequestProcessor.java:481(1391): 10:49:39.765 main Notifying 1 listeners of progress com.octo.android.robospice.request.listener.RequestProgress@41366160
I//MyRequestListener(1391): Progress update: 0.0
D//RequestProcessor.java:358(1391): 10:49:39.810 Thread-119 Sending progress COMPLETE
V//RequestProcessor.java:481(1391): 10:49:39.820 main Notifying 1 listeners of progress com.octo.android.robospice.request.listener.RequestProgress@413c6da0
I//MyRequestListener(1391): Progress update: 0.0

Am I missing something or it's just the way it is?

It's pretty clear for me that it is hard to measure progress for something so unpredictable as REST request but it says it does it :)

If more details would be needed please let me know.

Était-ce utile?

La solution

Request progress works. But it is not possible with actual design of Google Http Java Client or Spring Android to get the progress of a REST request. Other requests like binary request do provide progress as we have full control over the download.

Sorry if something was not clear in RS documentation about that. Can you provide a link to the misleading information so that we can update the wiki ?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top