public void addOnPausedListenerTest() { Debug.Log("UploadTask addOnPausedListenerTest"); byte[] data = new byte[100]; string filename = "addOnPausedListenerTest.data"; StorageReference storageReference = mAGCStorageManagement.getStorageReference(filename); UploadTask task = storageReference.putBytes(data, new FileMetadata()); task.addOnPausedListener(new MyPausedListener("1")) .addOnPausedListener(new Activity(), new MyPausedListener("2")) .addOnPausedListener(new MyExecutor("ExecutorListener"), new MyPausedListener("3")); MyPausedListener remove = new MyPausedListener("remove"); task.addOnPausedListener(remove); task.removeOnPausedListener(remove); task.pause(); Debug.Log("task.isPaused status: " + task.isPaused()); Thread.Sleep(2000); task.resume(); Debug.Log("after task.resume status: " + task.isPaused()); task.onPaused(); Debug.Log("task.onPaused status: " + task.isPaused()); Thread.Sleep(2000); task.resume(); Debug.Log("UploadTask addOnPausedListenerTest success"); }
public void addOnCanceledListenerTest() { Debug.Log("UploadTask addOnCanceledListenerTest"); byte[] data = new byte[100000]; string filename = "addOnCanceledListenerTest.data"; StorageReference storageReference = mAGCStorageManagement.getStorageReference(filename); UploadTask task = storageReference.putBytes(data, new FileMetadata()); Debug.Log("add addOnCanceledListener"); //task.addOnCanceledListener(new MyOnCanceledListener("MyOnCanceledListener")); MyOnCanceledListener actitvity_listener = new MyOnCanceledListener("ActivityListener"); task.addOnCanceledListener(new Activity(), actitvity_listener); MyOnCanceledListener executor_listener = new MyOnCanceledListener("ExecutorListener"); task.addOnCanceledListener(new MyExecutor("ExecutorListener"), executor_listener); MyOnCanceledListener listener = new MyOnCanceledListener("NormalListener"); task.addOnCanceledListener(listener); Debug.Log("remove addOnCanceledListener"); MyOnCanceledListener remove = new MyOnCanceledListener("remove"); task.addOnCanceledListener(new Activity(), remove); task.removeOnCanceledListener(remove); // UnityEngine.Debug.Log("cancel"); Debug.Log("task.isCanceled status: " + task.isCanceled()); if (!task.isCanceled()) { task.pause(); task.cancel(); } Debug.Log("after cancel: task.isCanceled status: " + task.isCanceled()); Debug.Log("UploadTask addOnCanceledListenerTest success"); }