It will depend a lot on the way you thought about your architecture, but if it is a situation where ADM is always with the app / page open, keep a ChildEventListener attached to your benchmark, and in the listener events you work with the new data coming in. I'll put the sample code from Google below for understanding, it's the same thing I always use in my apps. Regarding notification of new items, use the NotificationCompat itself to notify the user of the onChildAdded event:
ChildEventListener childEventListener = new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String previousChildName) {
//Evento que vai mostrar toda child que for adicionada na Reference.
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String previousChildName) {
//Evento que vai mostrar toda child que foi modificada.
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
//Evento que vai mostrar toda child que for removida da Reference.
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String previousChildName) {
//Evento que vai mostrar toda child que for reordenada na Reference. Particularmente nunca utilizei este evento.
}
@Override
public void onCancelled(DatabaseError databaseError) {
//Evento que vai mostrar todo erro que acontecer no banco de dados.
}
};
ref.addChildEventListener(childEventListener);