June 2018
Beginner to intermediate
394 pages
9h 2m
English
Another smart approach is to download the content into a file and create a local copy in the user's device. This will increase the application cache. We can download the file and create its replica in a some specific path. Also, whenever the file is required, it is available offline. The getFile() method returns DownloadTask, which helps in managing and monitoring the download status of the file:
schoolKidRef = storageRef.child("pictures/moni.jpg");File localFile = File.createTempFile("pictures", "jpg");schoolKidRef.getFile(localFile).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() { @Override public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) { // Local temp file has ...
Read now
Unlock full access