Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 不同权限Firebase Auth_Android_Firebase_Firebase Authentication - Fatal编程技术网

Android 不同权限Firebase Auth

Android 不同权限Firebase Auth,android,firebase,firebase-authentication,Android,Firebase,Firebase Authentication,我总是使用firebase进行登录身份验证,但这次我遇到了一个问题。 我的新应用程序使用两种类型的用户,管理员和普通用户 如何在firebase中区分这两种类型?您可以将firebase数据库与结合firebase用户ID和角色的对象一起使用 public class User { public String userId; public String role; public User(String userId, String role) { thi

我总是使用firebase进行登录身份验证,但这次我遇到了一个问题。 我的新应用程序使用两种类型的用户,管理员和普通用户


如何在firebase中区分这两种类型?

您可以将firebase数据库与结合firebase用户ID和角色的对象一起使用

public class User {
    public String userId;
    public String role;

    public User(String userId, String role) {
        this.username = username;
        this.email = email;
    }
}
写:

mDatabase = FirebaseDatabase.getInstance().getReference();
private void writeNewUser(String userId, String role) {
    User user = new User(name, role);

    mDatabase.child("users").child(userId).setValue(user);
}

您可以将Firebase数据库与结合Firebase用户ID和角色的对象一起使用

public class User {
    public String userId;
    public String role;

    public User(String userId, String role) {
        this.username = username;
        this.email = email;
    }
}
写:

mDatabase = FirebaseDatabase.getInstance().getReference();
private void writeNewUser(String userId, String role) {
    User user = new User(name, role);

    mDatabase.child("users").child(userId).setValue(user);
}

所以我不再使用firebase auth了?所以我不再使用firebase auth了?