stephanenicolas / robospice

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
Apache License 2.0
2.95k stars 545 forks source link

Pending Request and Notification #411

Closed anto2b closed 9 years ago

anto2b commented 9 years ago

Hi,

In my application, I use the (amazing) library RoboSpice with Retrofit. I have an Activity where I execute dependent requests each other ie for example In my Request1Listener I call my Request2, in my Request2Listener I call Request 3 etc... I have 2 questions :

  1. How do I know that all of the request executed in my Activity is completed? I tried to check in every listener if the number of pending request is zero (getSpiceManager().getPendingRequestCount() == 0) but it doesn' work.
  2. If the user leaves the activty for one reason or another, I would like to create a notification informing him of the progress of data with a percentage (I created the percentage calculation algorithm), and when all requests are completed (hence my question 1) I can also warn the user with a new notification.

Thank you in advance for your help and sorry for my english, I'm a French developer

nkeskinov commented 9 years ago

Context moved to http://stackoverflow.com/a/29206498/754439.