android - Firebase storage handling network interruptions when download in progress -


i trying download files firebase storage. works when there stable internet connection. if internet connection lost while downloading content halfway, keeps trying download content. how detect if there no content being downloaded?

i have implemented onprogesslistener of storagereference. however, not sure how make use of detect if there no progress in download.

new onprogresslistener<filedownloadtask.tasksnapshot>() {     @override     public void onprogress(filedownloadtask.tasksnapshot tasksnapshot) {         //what tasksnapshot detect if there no progress in download?     } }; 

uploads, downloads , other operations intended automatically retry , shield temporary interruptions. there configurable timeout end (fail) operation if cannot transfer packet in time. can set with:

//if interrupted more 2 seconds, fail operation. firebasestorage.getinstance().setmaxuploadretrytimemillis(2000); 

there different timeouts uploads, downloads , other operations.

with uploads, can attempt resume upload left off (if source file) if interrupted. need obtain "upload session uri" upload task.

task.addonfailurelistener(new onfailurelistener {   @override   public void onfailure(exception error) {      uri uploadsession = task.getsnapshot().getuploadsessionuri();      //if want retry later, feed uri last parameter      // putfile(uri, metadata, uri)   } } 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -