TimTheCoder 16 Newbie Poster

Hey guys, I am trying to upload text entered by a user of my app in an edit text to a google firebase application. Tried to find some reference online on how to do this, the article suggested I add Firebase.FirebaseDatabae.net which I added to the project via the Nuget package manager. I logged into my Google Firebase Console and got the Firebase url string for use with the client. I instantiated the client like below

protected string firebase_link = "https://xxxxxx-default-rtdb.firebaseio.com/";
FirebaseClient myclient;

//create a new instance of the firebase client
protected override void OnCreate(Bundle savedInstanceState){
 myclient = new FirebaseClient(firebase_link);
//define the buton for uploading the details in the edit text to the server
Button upload = FindViewById<Button>(Resource.Id.upload);
//subscribe to the event listener
upload.Click+=Upload_Click;
}
//method to upload text to the firebase app
private void Upload_Click(object sender, EventArgs e){
               try {
                if(myclient.Child("Users").PostAsync("Timothy").IsCompleted){
                    Snackbar.Make(email, "Firebase call completed succesfully", Snackbar.LengthLong).Show();
                }
                else
                {
                    Snackbar.Make(email, "An exception ocurred, try again in a little bit", Snackbar.LengthLong).Show();
                }
            }
            catch (Exception j)
            {
                Toast.MakeText(this,j.Message, ToastLength.Long).Show();    
            }
}

When I run the app, it is not making changes to the firebase database online, neither is it throwing an exception, it is just returning false for the if conditional structure inside the try catch block, please help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.