从 Firebase 存储下载时如何获得下载百分比?

How to get percentage download while downloading from Firebase Storage?

我可以得到已下载文件的百分比吗?我在 firebase.google.com 上找不到与此相关的任何内容。

使用这个。

public void onProgress(FileDownloadTask.Task task) {
double fprogress = (100.0 * task.getBytesTransferred()) / task.getTotalByteCount();
int bytes = task.getBytesTransferred();

String progress = String.format("%.2f", fprogress);
int constant = 1000;
if(bytes%constant == 0)
{
NotificationCompat.Builder mBuilder = 
    new NotificationCompat.Builder(getApplicationContext())
    .setSmallIcon(android.R.drawable.stat_sys_download)
    .setContentTitle("Downloading " + model.getName())
    .setContentText(" " + progress + "% completed" );

NotificationManager mNotificationManager = 
   (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

mNotificationManager.notify(mId, mBuilder.build());
}

}