Reputation: 21
I'm calling data from a Firebase Realtime Database into Android, and I get the following error: "W/SyncTree: Listen at /Datas failed: DatabaseError: Permission denied"
My rules are set to:
{"rules": {
".read": "auth == null",
".write": false}}
Changing "auth == null" to true also throws the same permission error.
I do not want to give user permission to write the db, just read.
I have already:
Connected the app to Firebase
Set dependencies
Written to the database
Any ideas?
Thanks
Upvotes: 1
Views: 5072
Reputation: 683
Fist try with change rules of read / write permission if it's still not working then try to clean and rebuild project. In my case i added another project google-service.json due to project change and this error prompt whenever try to write something in database then i search previous DB url in project and that URL had in auto generated files then I clean and rebuild project and it's working fine now .
Upvotes: 0
Reputation: 21
The google-services.json file needed to be downloaded and added to the app root directory. The error "DatabaseError: Permission denied" no longer appears.
Upvotes: 0
Reputation: 19415
Change the rules to :
{
"rules": {
".read": true,
".write": false
}
}
Upvotes: 2