-1
다운로드 한 파일의 비율을 확인할 수 있습니까? firebase.google.com에서 관련 항목을 찾을 수 없습니다.Firebase Storage에서 다운로드하는 동안 다운로드 비율을 얻는 방법은 무엇입니까?
다운로드 한 파일의 비율을 확인할 수 있습니까? firebase.google.com에서 관련 항목을 찾을 수 없습니다.Firebase Storage에서 다운로드하는 동안 다운로드 비율을 얻는 방법은 무엇입니까?
사용하십시오.
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());
}
}
도움 주셔서 감사합니다. –
내 경력에 도움이 될 수 있도록 답이 맞다면 친절하게 표시하십시오. –