Xamarin android observer subscription not working

I have a problem with the observer subscription of my firebase database. I subscribe my Listview to the realtime database of firebase with the following lines of code. I request the firebaseclient to give me an observer of the database, which I then ask to listen to any changes made in the database. If there are changes do the following.

Observer = firebase.Child("users").AsObservable<Account>();
List<Account> accountsFromDB = new List<Account>();
Observer.Subscribe(next => 
                    { 
                        accountsFromDB.Add(account.Object); 
                    }, 
                error => { Debug.WriteLine("error"); }, 
                onCompleted => 
                    { 
                        adapter.setData(accountsFromDB);
                        adapter.NotifyDataSetChanged(); 
                    }
                );

So when a change happens in the database the "next" will fetch every item in the database and add to the list, this works fine. After everything is collected from the database the "error" or "onCompleted" action should be called but aren't. the NuGet package I use with some documentation provided can be found here.

Sign In or Register to comment.