public void ReadDataOnce(List <string> branches, Action <DataSnapshot> listener) { try { var node = GetNode(branches); if (node != null) { DatabaseQueryUpdateHandler handler = (snapshot) => listener(snapshot); node.ObserveSingleEvent(DataEventType.Value, handler); } } catch (Exception ex) { } }
public DatabaseReference SubscribeForDataChange(List <string> branches, Action <DataSnapshot> listener) { try { var node = GetNode(branches); if (node != null) { List <string> handlersList = new List <string>(); handlersList.Add(listener.Method.Name); DatabaseQueryUpdateHandler handler = (snapshot) => listener(snapshot); node.ObserveEvent(DataEventType.Value, handler); } return(node); } catch (Exception ex) { return(null); } }