I am uploading files in the background in Android. And and to cancel it I store the reference. Now when cancel is clicked and I try to get that upload task from the reference it gives 0 results.
Heres my code:
// Storing the reference
StorageReference storeRef = FirebaseStorage.getInstance().getReference().child("Folder1").child("Folder2").child("Filename")
UploadTask task = storeRef.putFile(file);
intent.putExtra("reference", storeRef.toString());
// Retrieving the UploadTask
final String ref = intent.getStringExtra("reference");
if (ref == null) {
return;
}
StorageReference sRef = FirebaseStorage.getInstance().getReferenceFromUrl(ref);
List<UploadTask> taskList = sRef.getActiveUploadTasks(); // taskList.size() ---> 0