public List <Dictionary <string, object> > GetListOfLocation() { mListOfLocations = new List <Dictionary <string, object> >(); mFirebaseHelper.VisitedLocationRef().ValueChanged += (object sender, ValueChangedEventArgs args) => { if (args.DatabaseError != null) { Debug.LogError(args.DatabaseError); } if (args.Snapshot != null && args.Snapshot.ChildrenCount > 0) { Debug.Log(args.Snapshot.ChildrenCount); foreach (var childSnapshot in args.Snapshot.Children) { mVisitedPlacesInfo = new VisitedPlacesInfo( childSnapshot.Child(StringValues.LATITUDE).Value.ToString(), childSnapshot.Child(StringValues.LONGTITUDE).Value.ToString()); mListOfLocations.Add(mVisitedPlacesInfo.LocationCordinates()); } /* testing purpose only * foreach (Dictionary<string, object> locations in mListOfLocations) { * * latitude = locations[StringValues.LATITUDE].ToString(); * longtitude = locations[StringValues.LONGTITUDE].ToString(); * Debug.Log(latitude + " " + longtitude); * } */ } }; return(mListOfLocations); }
public void AddLocation(string latitude, string longtitude) { //TODO Will get the name and cordinates later from the user through the maps mVisitedPlacesInfo = new VisitedPlacesInfo(latitude, longtitude); Dictionary <string, object> visitedDict = mVisitedPlacesInfo.LocationCordinates(); // InitializeFirebase(); mFirebaseHelper.NewLocation().UpdateChildrenAsync(visitedDict); }