Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why firebase upload tasksnapshot is return only 0 and 100% progress? [duplicate]

Firebase upload manager return only 0 to 100 % while uploading file. Many users of stackoverflow said,

  • it happens only when file size<256 kb(very small size)
  • it is working better only when file size is larger approx 2 to 3 MB.

But i want smooth 0,1,2,3,...100% of uploading task, is it possible ,if yes please explain.

filepath.putFile(sendingImageURI).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
                                @Override
                                public void onProgress(UploadTask.TaskSnapshot taskSnapshot)
                                {
                                    double progress = ((100.0 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount())/100;
                                    Progressbar.setProgress((int) progress);
                                    progressText.setText(String.valueOf(progress));
                                    Log.i("progress",String.valueOf(progress));//this print 0 and 100 only
                                }
                            });

enter image description here

like image 894
Vora Avatar asked Jan 02 '26 03:01

Vora


1 Answers

It sounds like you already have your answer: "it happens only when file size<256 kb(very small size)". The SDK is only going to invoke your callback for larger increments of uploaded bytes. There is no way to control this programmatically, unless you build your own version of the SDK using code from GitHub that works the way you want. You can always file a feature request if you would like different behavior.

like image 193
Doug Stevenson Avatar answered Jan 03 '26 15:01

Doug Stevenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!