protected override void OnCreate(Bundle savedInstanceState) { // Well, just config with your own name app in manifest.xml // and yout own "google-services.json" file config from Firebase. that's all. base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); fireApp = Firebase.FirebaseApp.InitializeApp(this); fireFirestore = Firebase.Firestore.FirebaseFirestore.Instance; fireDatabase = Firebase.Database.FirebaseDatabase.Instance; Button btn1 = FindViewById(Resource.Id.Button1) as Button; btn1.Click += delegate { // So here it's crash the App. DocumentReference docRef = fireFirestore.Collection("collection1").Document("doc1"); docRef.Get() .AddOnCompleteListener(this) .AddOnFailureListener(this); }; }
// Initialization method. Called after the state // is added to the stack. public override void Initialize() { database = Firebase.Database.FirebaseDatabase.GetInstance(CommonData.app); database.GetReference(path).GetValueAsync().ContinueWith(HandleResult); menuComponent = SpawnUI <Menus.SingleLabelGUI>(StringConstants.PrefabsSingleLabelMenu); UpdateLabelText(); }
public DBStruct(string name, Firebase.FirebaseApp app) { this.app = app; database = Firebase.Database.FirebaseDatabase.GetInstance(this.app); dbPathName = name; data = new T(); newData = new T(); database.GetReference(dbPathName).ValueChanged += OnDataChanged; }
// Initialization method. Called after the state // is added to the stack. public override void Initialize() { Network.TestConnection(true); database = Firebase.Database.FirebaseDatabase.GetInstance(CommonData.app); database.GetReference(path).ValueChanged += HandleResult; menuComponent = SpawnUI <Menus.SingleLabelGUI>(StringConstants.PrefabsSingleLabelMenu); UpdateLabelText(); }
public DBTable(string name, Firebase.FirebaseApp app) { this.app = app; tableName = name; database = Firebase.Database.FirebaseDatabase.GetInstance(this.app); data = new Dictionary <string, DBObj <T> >(); newData = new Dictionary <string, T>(); deletedEntries = new List <string>(); addListeners(); }