Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

[Android] Cancel task #369

Closed
pgonzalez-santiago opened this issue May 24, 2017 · 5 comments
Closed

[Android] Cancel task #369

pgonzalez-santiago opened this issue May 24, 2017 · 5 comments

Comments

@pgonzalez-santiago
Copy link

Hi all, I am using fetch-blob in my react native application and I having some problems, only in android, cancelling the download.

I have

task = RNFetchBlob
.config({ path : path })
.fetch('GET', url, {})

task.then((res) => res)
.catch((err) => err )

When I run task.cancel() its works perfect on iOs devices returning the error, but when I do it in Android it returns the response of the 'then'.

Do you have any ideas? Thank you

RN: 0.43
Fetch-blob: ^0.10.4

@Crash--
Copy link

Crash-- commented May 29, 2017

Just find out the same behavior

My current workaround:

if (this.task) {
    this.task.cancel();
    this.canceled = true;
}
///...
this.task.then((res) => {
if (res.respInfo.status == '200') {
///...
 if (this.canceled){ 
return;
}
}
}

@pgonzalez-santiago
Copy link
Author

@Crash-- Thank you, that solved my problem but the issue still there.

@IceNeoMax
Copy link

i was ran into the same problem

@wkh237
Copy link
Owner

wkh237 commented Jul 5, 2017

Would this relate to #268 ?

@wkh237
Copy link
Owner

wkh237 commented Jul 9, 2017

Closing this issue as there's already a possible fix in #268, related discussion will continue in that thread also.

@wkh237 wkh237 closed this as completed Jul 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants