Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

downloading file not being paused with download id #32

Closed
altaf2892 opened this issue May 1, 2017 · 5 comments
Closed

downloading file not being paused with download id #32

altaf2892 opened this issue May 1, 2017 · 5 comments
Assignees

Comments

@altaf2892
Copy link

altaf2892 commented May 1, 2017

project links removed code snippet commented

@tonyofrancis
Copy link
Owner

Ill have a look at the sample and will post back here

@tonyofrancis
Copy link
Owner

@altaf2892 Have not been able to have a look at your code. Can you replicate the issue and post the logs here? Do the downloadId match the request id you want to pause?

@altaf2892
Copy link
Author

see below implementation to pause running download onclkick

`if (fetch != null) {
List requestInfo = fetch.get();
for (int i = 0; i < requestInfo.size(); i++) {
if (requestInfo.get(i).getId() == model.getId()) {
Log.e("match", requestInfo.get(i).getId() + " " + model.getId());
try {
fetch.pause(model.getId());

                        } catch (Exception e) {
                            Toast.makeText(holder.itemView.getContext(), e.toString(), Toast.LENGTH_SHORT).show();
                        }
                    }
                }
            } else {
                Toast.makeText(holder.itemView.getContext(), "error occurred", Toast.LENGTH_SHORT).show();
            }
        }`

i get printed log with same match id but downloading not getting pause

@tonyofrancis
Copy link
Owner

@altaf2892 you do not have to get all the requests from fetch in order to match the one you are looking for. Simply call fetch.get(downloadId) and it will return the request if it exists. Attach a FetchListener to fetch before performing any operations in order to get status updates of a request. Have a look at the sample code in this project.

@tonyofrancis
Copy link
Owner

tonyofrancis commented May 9, 2017

@altaf2892 Are you sure you are pausing the right request with the right id? Please compare the id when you have enqueued the request with the model id when you are clicking the pause button. I do have a feeling they do not match. Does your catch method every get executed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants