Firebase - uploading images when internet is offline -


firebase has great option of using database , sending data db if offline, , when connection again, sends automaticlly data db.

is possible firebase storage? send images if internet offline, , when internet on again, send images files automaticlly?

if so, how can it? if not firebase, other option?

thanks

yes. firebase storage client supports resuming uploads. see firebase storage documentation uploads (ios, web, android).

from there android:

uploadtask = mstorageref.putfile(localfile); sessionuri = uploadtask.getuploadsessionuri(); //save sessionuri persistent storage in case process dies. 

and resume:

//resume upload task left off when process died. //to this, pass sessionuri last parameter uploadtask = mstorageref.putfile(localfile,                 new storagemetadata.builder().build(), sessionuri); 

update (20160809)

one way handle sessionuri:

  1. when create uploadtask, sessionuri , store app's sharedpreferences.
  2. when uploadtask completes, remove sessionuri app's sharedpreferences.
  3. when app restarts, check if there sessionuri in sharedpreferences. if so: resume upload.

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -