Member 13368516 Ответов: 0

Таблицы базы данных опорному пункту перейти по ссылке изображения в огневой базы хранения


Im trying to create a table that will store the reference of the image in Firebase storage! The image is being uploaded and stored in Firebase Storage but I cant create the table to reference it in my database

Here is my code:


Что я уже пробовал:

private async void UploadPhoto()
    {

        if (filePAth != null)
        {
            progressDialog = new ProgressDialog(this);
            progressDialog.SetTitle("Uploading...");
            progressDialog.Window.SetType(Android.Views.WindowManagerTypes.SystemAlert);
            progressDialog.Show();

            var images = storageRef.Child("images/" + Guid.NewGuid().ToString());
            images.PutFile(filePAth)
                .AddOnProgressListener(this)
                .AddOnSuccessListener(this)
                .AddOnFailureListener(this);
        }


    }

public async void OnSuccess(Java.Lang.Object result)
    {
        //get the logged on user so we know who made the category
        var user = FirebaseAuth.Instance.CurrentUser;

        //Link the photo in storage to database reference 
        try
        {
            var newImageDetails = storageRef.Child("images");
            Photo photos = new Photo();
            photos.categoryId = newImageDetails.Name;
            photos.photoId = newImageDetails.Name;
            photos.tagName = addTag.Text;

            if (user != null)
            {
                var uid = user.Uid;
                //set the users id to the category
                photos.uid = uid;
            }

            var firebase = new FirebaseClient(FirebaseURL);
            var item = await firebase.Child("photos").PostAsync(photos);
        }

        catch (System.Exception e)
        {

        }

        progressDialog.Dismiss();
        Toast.MakeText(this, "Successfully uploaded image", 
        ToastLength.Short).Show();
    }


When I test with breakpoints the code says that the items are null in the try catch block?

Im trying to get the reference of the newly uploaded image!

0 Ответов