Home » c# » c# – Firebase with Xamarin addEventListener-Exceptionshub

c# – Firebase with Xamarin addEventListener-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment


I’m kind of new to this, so I need some pointers in implementing the Firebase ValueEventListener just like they say on documentation.

public interface ValueEventListener

Classes implementing this interface can be used to receive events about data changes at a location. Attach the listener to a location user addValueEventListener(ValueEventListener).”

I want to use something like this below, but I don’t have access to addListenerForSingleValueEvent. I’m searching for some days now and I still didn’t figure it out what I’m missing.

Query dateQuery = FirebaseDatabase.getInstance().getReference("Daily Meal").orderByChild("date").equalTo(user.getDate());

dateQuery.addListenerForSingleValueEvent(new ValueEventListener() {
            public void onDataChange(DataSnapshot dataSnapshot) {
                if (dataSnapshot.exists()) {
                } else {
                    if (!TextUtils.isEmpty(dt))
                        String id = databaseBazars.push().getKey();
                        MealE bz = new MealE(dt, s1, s2, s3, s4, s5, s6, s7);
                    } else {
        // put rest of your code here
How to&Answers: