Before start it, please understand I’m newbie
I coded it
public void Start()
{
UserInformationRenewal();
}
public void UserInformationRenewal()
{
FirebaseDatabase.DefaultInstance.RootReference
.Child("users")
.Child(firebaseLogin.userId)
.Child("received")
.ValueChanged += HandleValueChanged;
}
public void UserInformationReset()
{
FirebaseDatabase.DefaultInstance.RootReference
.Child("users")
.Child(firebaseLogin.userId)
.Child("received")
.ValueChanged -= HandleValueChanged;
}
void HandleValueChanged(object sender, ValueChangedEventArgs args)
{
print("changed");
if ((bool)args.Snapshot.Value == true) SocialNotification(true);
else if ((bool)args.Snapshot.Value == false) SocialNotification(false);
}
and UserInformationReset() doesn’t work
(firebaseLogin.userId is “FirebaseAuth.DefaultInstance.CurrentUser.UserId;” and it works well)
I tried print(“success”) in UserInformationReset(), it printed “success” successfully but ValueChange event has not removed
and tried
public void UserInformationReset()
{
FirebaseDatabase.DefaultInstance.RootReference
.Child("users")
.Child(firebaseLogin.userId)
.Child("received")
.SetValueAsync("test");
}
then, “test” value set in “reveiced” successfully in Firebase Realtime Database
there’s no error message
New contributor
asdf1244 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.