title: How to use firebase database from broadcastreceiver
body: <p>I'm trying to use Firebase Database from a <code>BroadcastReceiver</code> to fetch some data. Unfortunately the user is <code>null</code> sometimes, which means I can't use the UID the fetch data.</p>
  
  <pre><code>@Override
  public void onReceive(final Context context, Intent intent) { 
      FirebaseAuth.getInstance().addAuthStateListener(new FirebaseAuth.AuthStateListener() {
                  @Override
                  public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                      FirebaseUser user = firebaseAuth.getCurrentUser();
                      if(user != null){
                          //sometimes not null
                      }else{
                          //sometimes null
                      }
                  }
       });
  }
  </code></pre>
  
  <p>Also <code>FirebaseAuth.getInstance().getCurrentUser</code> is <code>null</code> sometimes. Also, i'm not running long time opertaion inside my <code>broadcastreceiver</code>. I'm talking about fetching a single opjes without any nodes under it.</p>
  
  <p>How can I use Firebase database from a <code>BroadcastReceiver</code>?</p>