Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to download pdf file from firebase storage and save in external private storage in android

public long downloadFile(Context context, String fileName, String fileExtension, String destinationDirectory, String url) {


     DownloadManager downloadmanager = (DownloadManager) context.
            getSystemService(Context.DOWNLOAD_SERVICE);
     Uri uri = Uri.parse(url);
     DownloadManager.Request request = new DownloadManager.Request(uri);

     request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
     request.setDestinationInExternalFilesDir(context, destinationDirectory, fileName + fileExtension);

     return downloadmanager.enqueue(request);
}
 
PREVIOUS NEXT
Tagged: #download #pdf #file #firebase #storage #save #external #private #storage #android
ADD COMMENT
Topic
Name
9+5 =