Skip to content Skip to sidebar Skip to footer

Firebase Storage Upload Progress Inaccurate

There is a problem with the onProgress function that is overrided by addOnProgressListener. My problem is that the TaskSnapshot when I try to upload an image does not return the b

Solution 1:

firebaser here

The progress is measured in chunks of 256KB. Since your file is smaller than that, it fits in one chunk and progress thus jumps from 0% to 100% in one go.

We have an open task to improve the granularity of the progress measurement in the case of smaller files and lower bandwidth connections.


Solution 2:

According to firebase storage documentation, they return the progress values in double like 0.13,0.15,0.24,0.55 etc .Since you are casting to int type it always returns 0. So the solution is dont cast to int just store it in double

double progress=(taskSnapshot.getBytesTransferred())/taskSnapshot.getTotalBytesCount); System.out.println(progress*100 +"");


Post a Comment for "Firebase Storage Upload Progress Inaccurate"