public void uploadFile(string filename, int size)
        {
            Debug.Log("upload file start.");

            byte[] data = new byte[size];

            StorageReference storageReference = mAGCStorageManagement.getStorageReference(filename);

            UploadTask task = storageReference.putBytes(data, new FileMetadata());

            task.addOnFailureListener(new MyFailureListener())
            .addOnSuccessListener(new MySuccessListener())
            .addOnProgressListener(new MyProgressListener())
            .addOnPausedListener(new MyPausedListener());

            StorageTask.ErrorResult err = new MyErrorResult();
            Exception e = err.getError();

            task.setResult(err.obj);
            err = task.getResult();
            if (err == null)
            {
                Debug.Log("uploadFileTest fail, getResult err is null.");
                return;
            }

            StorageTask.ErrorResult timePointState = task.getTimePointState();
            if (timePointState == null)
            {
                Debug.Log("uploadFileTest fail, getTimePointState result is null.");
                return;
            }

            Exception exp = task.getException();

            if (exp == null)
            {
                Debug.Log("uploadFileTest fail, getException result is null.");
                return;
            }

            task.setException(exp);

            AndroidJavaObject ajObj = task.getResultThrowException(new AndroidJavaClass("java.lang.Exception"));

            if (ajObj == null)
            {
                Debug.Log("uploadFileTest fail, getException result is null.");
                return;
            }


            Debug.Log("upload file test success.");
        }
        public void addOnFailureListenerTest()
        {
            Debug.Log("UploadTask addOnFailureListenerTest");


            byte[] data     = new byte[100000];
            string filename = "addOnFailureListenerTest.data";

            StorageReference storageReference = mAGCStorageManagement.getStorageReference(filename);
            UploadTask       task             = storageReference.putBytes(data, new FileMetadata());

            task.addOnFailureListener(new MyFailureListener("NormalListener"))
            .addOnFailureListener(new Activity(), new MyFailureListener("ActivityListener"))
            .addOnFailureListener(new MyExecutor("ExecutorListener"), new MyFailureListener("ExecutorListener"));

            MyFailureListener remove = new MyFailureListener("remove");

            task.addOnFailureListener(remove);
            task.removeOnFailureListener(remove);

            Debug.Log("UploadTask addOnFailureListenerTest success");
        }
        public void uploadFile(string path)
        {
            Debug.Log("upload file start.");

            File file = new File(path);

            if (!System.IO.File.Exists(path))
            {
                Debug.Log("upload file does not exists: " + path);
                return;
            }

            StorageReference storageReference = mAGCStorageManagement.getStorageReference(path);
            UploadTask       task             = storageReference.putFile(file);

            task.addOnFailureListener(new MyFailureListener()).addOnSuccessListener(new MySuccessListener());

            Debug.Log("upload file end.");
        }