我试图检索数据,但是它给了我一个权限被拒绝的错误。我将参数设置为公众视野。
{
"rules": {
"Person":{
".read": true,
".write": true,
".indexOn": "token"
}
}
}
我的数据库看起来像这样
hello-8d296
Person
-KjG44HWo5k4K3Fpaf4o
nodes: "5,6,1,2,3"
token: "56561"
这是我的代码
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
//Getting values to store
String token = editToken.getText().toString().trim();
Query query = rootRef.orderByChild("token").equalTo(token, "token");
query.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot snapshot, String previousChildKey) {
Person user = snapshot.getValue(Person.class);
String demo=user.getNodes();
System.out.println("Nodes: " + demo);
}
//other child functions
}
我在某个地方出错了?