title: How to listen for firebase events in android background service?
body: <p>Tried to listen for firebase events in background Service. Please find code snippet below,</p>
  
  <pre><code> @Override
   public int onStartCommand(Intent intent, int flags, int startId) {
  
     ValueEventListener postListener = new ValueEventListener() {
       @Override
       public void onDataChange(DataSnapshot dataSnapshot) {           
         Post post = dataSnapshot.getValue(Post.class);        
       }
  
       @Override
       public void onCancelled(DatabaseError databaseError) {        
       }
     };
     mPostReference.addValueEventListener(postListener);
  
     return START_STICKY;
   }
  </code></pre>
  
  <p>onDataChange() method is getting untill my Activity is alive, once Activity is exited,  the method is not getting called.</p>
  
  <p>Anyone please help.</p>