benjreinhart / react-native-aws3

Pure JavaScript React Native library for uploading to AWS S3
MIT License
399 stars 151 forks source link

Android upload progress #7

Closed gbau closed 8 years ago

gbau commented 8 years ago

On Android, the progress method never gets called.

RNS3.put(file, options)
  .then(/* ... */)
  .catch(/* ... */)
  .progress(/* never called */);
benjreinhart commented 8 years ago

What version of react native are you using? I know in the past they had not supported upload progress in their XMLHttpRequest abstraction for android, which prompted me to add this guard when trying to add a progress callback. That guard was also present in their examples of using XMLHttpRequest.

gbau commented 8 years ago

Thanks for the quick response! I'm using 0.26.3. Tried to skim the release notes for recent react native versions, but are they supporting XHR upload progress on Android now?

benjreinhart commented 8 years ago

It looks like they should per their android example in master.

I can try to take a look later but my project is iOS only so I haven't had to use this on android yet. I would expect this library to work on android though, since it's not view related and uses RN's abstractions like XMLHttpRequest which should work the same on iOS and android.

In the meantime, this library is pretty small and it should be straightforward to add some logging to see if your function is being set on this._xhr.upload.onprogress here.

gbau commented 8 years ago

Awesome! Appreciate the feedback and this library you've created!

benjreinhart commented 8 years ago

Ohh another thing I'd try is to run the examples from your current version of RN. Try to run that android example I linked to and see if all is working there. If it is, then you'll know for sure that XMLHttpRequest is working as expected and we'll have to figure out what is going wrong here.

joelwass commented 8 years ago

It doesn't work on android, you should update the README to iOS only since it hasn't been tested and currently doesn't work for Android.

I'll work on my own branch and send a PR

benjreinhart commented 8 years ago

@joelwass can you provide any insight into what is not working? This library makes use of standard RN APIs that are supposed to work across iOS and android. So in theory, it should be working for both.

Is the file upload making it to AWS? Is the response handling broken? Nothing working? What version of RN are you on? Is it just the progress method that isn't working, like what this PR was intended for? If not can you open a separate issue with as much detail as you can provide?

Thanks

joelwass commented 8 years ago

There is no response, i'm working on error handling because you don't catch an error on the xml request. The xhr has an error but it's not being caught.... from my debugging it's because android does file URI differently, so a file path in iOS won't work for Android. At least that's my theory, i'm still digging

MrHubble commented 6 years ago

@joelwass were you able to get this working on Android? If yes, could you please provide your solution?

saikiranoptisol commented 5 years ago

@joelwass is it working in andorid kindly help I got struck with this very badly