gpt4 book ai didi

java - Firebase,删除用户时无法删除用户记录

转载 作者:行者123 更新时间:2023-12-02 11:37:13 25 4
gpt4 key购买 nike

当我删除用户时,我无法删除他的记录。我知道哪些位置将被删除,但是当用户成功删除后,值仍然在数据库中。

.....
final String useruid=""+user.getUid();

//auth = FirebaseAuth.getInstance();
//user=auth.getCurrentUser();


dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(checkBox.isChecked()){
if (user != null) {

user.delete()
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
FirebaseDatabase.getInstance().getReference().child("profileinfos").child(useruid).removeValue();
FirebaseDatabase.getInstance().getReference().child("holograminfos").child(useruid).removeValue();


Toast.makeText(Ayarlar.this, "Hesabınız başarılı bir şekilde silindi. ", Toast.LENGTH_SHORT).show();
dialog.dismiss();
startActivity(new Intent(Ayarlar.this, LoginActivity.class));
finish();
} else {
Toast.makeText(Ayarlar.this, "Bir Hata Meydana Geldi.", Toast.LENGTH_SHORT).show();

}
}});
}
}
else
{
Toast.makeText(Ayarlar.this, "Onaylamak için lütfen kutucuğu seçiniz.", Toast.LENGTH_SHORT).show(); return;
}
}
});

Thats my database.

没有异常(exception)。

最佳答案

您必须先从数据库中删除它,然后从经过身份验证的控制台中删除它,尝试以下操作:

FirebaseDatabase.getInstance().getReference().child("profileinfos").child(useruid).removeValue();
FirebaseDatabase.getInstance().getReference().child("holograminfos").child(useruid).removeValue();

user.delete().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(Ayarlar.this, "Hesabınız başarılı bir şekilde silindi. ", Toast.LENGTH_SHORT).show();
dialog.dismiss();
startActivity(new Intent(Ayarlar.this, LoginActivity.class));
finish();
} else {
Toast.makeText(Ayarlar.this, "Bir Hata Meydana Geldi.", Toast.LENGTH_SHORT).show();

}
}});
}

关于java - Firebase,删除用户时无法删除用户记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48840330/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com