
Let’s see how to do this with Xamarin on an Android device. But when the user clicks on a Special that takes them to the next page in the NavigationPage setup and then clicks back to go to the SpecialsListPage, the OnAppearing method is called again and attaches a new listener to my node and that causes the list to update again with the same data thus causing duplicates.Debugging allows us to see our app's flow and to find and fix errors. Now this works just fine when the app starts up. callback for snapshot has access to the list of Specials that is the ItemSource of the ListView call function to attach listeners for child added event type So what I did was to override these two methods in the SpecialsListPage class like this: protected override void OnAppearing() Now these two methods are similar to OnAppearing and OnDisappearing in the Page class. I tried to google what the best place would be to attach my event listeners for the database but I only found examples for Swift: The post said to place listeners in the viewWillAppear method and to remove listeners in viewDidDisappear method. The SpecialsViewModel class has a Specials property that is an ObservableCollection type that is set as the ItemSource for my ListView in the SpecialsListPage page.

In the constructor of SpecialsListPage I set the BindingContext of the page to a view model called SpecialsViewModel. I have a page called SpecialsListPage that is my root page in a NavigationPage setup. So returning to my original question about where to attach the listeners: This concludes the setup and you should be able to use Firebase from shared code.

plist file as instructed in the Firebase App setup and add it to your platform's directory - for iOS it should be in.

