Skip to content

Android xhr.upload.onprogress and addEventListener('progress') not supported? #11853

Closed

Description

@dguillamot

Description

We are doing XMLHttpRequest PUT request (sending base64 encoded image data, setting content type header, etc).

iOS sends progress updates, Android does not.

We tried setting progress listener the following ways:

xhr.addEventListener('progress')
xhr.upload.addEventListener('progress')
xhr.upload.onprogress = () => {}
xhr.onprogress = () => {}

None of these handlers end up being called on Android, however on iOS they work fine.

The request completes successfully with a 200.

Reproduction

Solution

Additional Information

  • React Native version: 0.39.2
  • Platform: both Android and iOS tested (issue only on Android)
  • Operating System: MacOS

Activity

  1. dguillamot commented on Jan 13, 2017

    @dguillamot
    Author

    Ended up moving to a native (Obj-c and Java) solution for now which does provide upload progress events on Android.

    Regarding XmlHttpRequest, not sure if the Android interface is different from iOS or not but no luck with XmlHttpRequest progress when uploading on Android.

  2. dguillamot commented on Jan 16, 2017

    @dguillamot
    Author

    @christopherdro Yes, I did see that last week but xhr.upload.addEventListener('progress') did not result in any updates on Android - only iOS. For now, we have solved it with a Native solution, thanks though.

  3. bogobogo commented on Feb 16, 2017

    @bogobogo

    Hey @dguillamot, would you mind sharing your solution? I am facing the same problem, and I currently don't have the knowledge to implement it natively (learning java but that will take me some time...).

  4. GeoffreyPlitt commented on Mar 13, 2017

    @GeoffreyPlitt

    I'm on RN=0.42 and using XHR with a Content-Length set before uploading begins. I'm seeing the progress events, but no bytesSent or length or anything else that I can use to compute a progress%. Anybody else have luck with this?

  5. ranjitpandit commented on Jun 11, 2017

    @ranjitpandit

    Any ideas how to get send progress events on Android with bytesSent?

  6. agu-z commented on Jun 22, 2017

    @agu-z

    @christopherdro Why is this issue closed? This problem persists, doesn't it?

  7. 1stman commented on Aug 30, 2017

    @1stman

    i trying to upload video with youtube v3 api, and have some dilemma. When i use FormData , xhr.upload.onprogress is working. But then youtube api return processing error, because FormData add some data to file object. So, i use something like xhr.send({uri: url}); and it works, video is uploading, BUT xhr.upload.onprogress stopped working. I still don't know why...
    P.S. sorry for my ugly english

  8. locked as resolved and limited conversation to collaborators on May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions