title: Firebase on android not retrieving data
body: <p>I have been able to successfully upload and delete data from my firebase repo using the guide here:
  <a href="https://www.firebase.com/docs/android/guide/saving-data.html" rel="nofollow">https://www.firebase.com/docs/android/guide/saving-data.html</a></p>
  
  <p>However if I try and retrieve the data using the the Firebase guide here:
  <a href="https://www.firebase.com/docs/android/guide/retrieving-data.html" rel="nofollow">https://www.firebase.com/docs/android/guide/retrieving-data.html</a></p>
  
  <p>the app activity just hangs - there is no call back to onDataChange or onCancel. I am using the exact code in the example which has worked until this point in the guide (in my Activity onCreate() method):</p>
  
  <pre><code>Firebase ref = new Firebase("https://docs-examples.firebaseio.com/web/saving-data/fireblog/posts");
  
  ref.addValueEventListener(new ValueEventListener() {
      @Override
      public void onDataChange(DataSnapshot snapshot) {
          System.out.println(snapshot.getValue());
      }
  
      @Override
      public void onCancelled(FirebaseError firebaseError) {
          System.out.println("The read failed: " + firebaseError.getMessage());
          }
      });
  </code></pre>
  
  <p>There is data at the example URL so should work. I am running on a phone running Android 4.0.3.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks,
  Riz</p>
  
  <p>Edit: I tried on my Samsung Note 4 running Android 5.1.1 and Firebase works fine. Doesn't work on my Huawei running Android 4.0.3. Something to do with the Android version?</p>
  
  <p>Edit 2: So it turns out the answer below was right after all. I found an old bit of code in one of my helper classes that was pausing the thread whilst it waited for something. I rewrote it to be truly asynchronous and it fixed the problem. Many thanks - I have accepted the answer.</p>