use*_*167 8 android kotlin firebase firebase-security firebase-realtime-database
我是firebase的新手.
我如何通过以下规则?
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我试过将规则改为以下,
{
"rules":
{
".read": true,
".write": true,
}
}
Run Code Online (Sandbox Code Playgroud)
但是有一个错误
mismatched input '{' expecting {'function', 'service', 'syntax'}
Run Code Online (Sandbox Code Playgroud)
下面是db结构.
目前,这是我的代码(不断返回Permission-denied):
// [START initialize_database_ref]
mDatabase = FirebaseDatabase.getInstance().reference
// [END initialize_database_ref]
val result = HashMap<String, Any> ()
result.put("timestamp", getCurrentTime())
result.put("user_id", USER_ID)
result.put("x_position", -1)
result.put("y_position", -1)
mDatabase!!.ref.child("raw data").child("Z9QD79lDzP7MpD6feWeJ").setValue(result).addOnFailureListener(object : OnFailureListener {
override fun onFailure(@NonNull e: Exception) {
Log.d("firebase", e.localizedMessage)
}
})
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激!谢谢 :)
| 归档时间: |
|
| 查看次数: |
5813 次 |
| 最近记录: |