I have a problem with Progress Bar showing % of download completed. I have a service class in which the downloading takes place. I can get the start time and end time of do
final ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.setTitle("Uploading...");
progressDialog.show();
progressDialog.setCanceledOnTouchOutside(false);
StorageReference reference = storageReference
.child("images/" + UUID.randomUUID().toString());
reference.putFile(filePath).addOnProgressListener(new
OnProgressListener() {
@Override
public void onProgress(@NonNull UploadTask.TaskSnapshot
taskSnapshot) {
double progress =
(100.0*taskSnapshot.getBytesTransferred()/taskSnapshot.getTotalByteCount());
progressDialog.setMessage("Uploaded "+
(int)progress+"%");
}
});