title: Real time Database of Firebase not working from android studio i can't able to upload on it?
body: <p>I have already fix the read and right rules on realtime database of firebase still i am unable to read and write on it.</p>
  <pre><code>{
    &quot;rules&quot;: {
      &quot;.read&quot;: &quot;true&quot;,
      &quot;.write&quot;: &quot;true&quot;
    }
  }
  </code></pre>
  <p>And i have also tried this :</p>
  <pre><code>{
    &quot;rules&quot;: {
      &quot;.read&quot;: true,
      &quot;.write&quot;: true
    }
  }
  </code></pre>
  <p>Firebase Storage Rule:</p>
  <pre><code>    rules_version = '2';
  service firebase.storage {
    match /b/{bucket}/o {
      match /{allPaths=**} {
        allow read, write: if true;
      }
    }
  }
  </code></pre>
  <p>Firebase Storage Rule is Working Correctly because the image gets uploaded and onSuccessListener get called.</p>
  <p>The Code Which i am using to setValue on database is shown below and
  I have already defined references as :</p>
  <pre><code>    storageReference = FirebaseStorage.getInstance().getReference(&quot;Events_Details&quot;);
      databaseReference = FirebaseDatabase.getInstance().getReference(&quot;Events_Details&quot;);
  
      private void uploadUserInformationToDatabase() {
          progressDialog.show();
          if (image_uri != null) {
  
              //this will create a big_number.jpg and when we call .child this means we are
              //going to add something inside Events_Images Directory
              StorageReference fileReference = storageReference.child(System.currentTimeMillis() + &quot;.&quot; + getFileExtension(image_uri));
  
              uploadTask = fileReference.putFile(image_uri)
                      .addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
                          @Override
                          public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
  
                              //Now we need to get the url of the image that you have uploaded.
                              Task&lt;Uri&gt; uri = taskSnapshot.getStorage().getDownloadUrl();
                              while (!uri.isComplete());
                              String url = uri.getResult().toString();
                              createUserEvent.setImageUrl(url);
  
                              //now we will save this object in our database
                              String uploadId = databaseReference.push().getKey();
                              databaseReference.child(uploadId)
                                               .setValue(createUserEvent);
                              progressDialog.dismiss();
  
                              Toast.makeText(context, &quot;Event Created Successfully&quot;, Toast.LENGTH_SHORT).show();
                          }
                      })
                      .addOnFailureListener(new OnFailureListener() {
                          @Override
                          public void onFailure(@NonNull Exception e) {
                              Toast.makeText(context, e.getMessage(), Toast.LENGTH_SHORT).show();
                              progressDialog.dismiss();
                          }
                      });
  
          } else {
              progressDialog.dismiss();
              Toast.makeText(context, &quot;No File Selected&quot;, Toast.LENGTH_SHORT).show();
          }
      }
  </code></pre>
  <p>Toast for Event Created Successfully displays every time and image also gets uploaded to storage but the object doesn't save on realtime database. And CreateUserEvent is just a class, the object of which i want to save to realtime database along with the image which i will upload to storage. The image always get success in uploading on firebase storage and after it onSuccess function gets called and inside onSuccess function i have written Code for object to save on realtime database but that doesn't work.Please help me to solve it i have already wasted 2 days of mine but can't able to fix this problem.
  <a href="https://i.stack.imgur.com/nExIk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nExIk.png" alt="enter image description here" /></a></p>