Chat bot using Firebase (Read, write and database structure)
https://www.udacity.com/course/firebase-in-a-weekend-by-google-android--ud0352
Google Codelabs
https://codelabs.developers.google.com/codelabs/firebase-android/index.html?index=..%2F..%2Findex#2
Querying Data
https://stackoverflow.com/questions/39024702/firebase-querying-data
https://www.udacity.com/course/firebase-in-a-weekend-by-google-android--ud0352
Database Security Rules:
{
"rules": {
"chat" : {
"messages" : {
".read": "auth != null",
".write": "auth != null"
}
},
"special_chat" : {
"messages": {
".read":
"root.child('users').child(auth.uid).child('paid').val() === true",
".write":
"root.child('users').child(auth.uid).child('paid').val() === true"
}
}
}
}
Cascading Rules
When
.read
and .write
rule permissions are evaluate to true
, this cascades to all of the rule’s children. Only truth is cascading; falseness is not cascading.Google Codelabs
https://codelabs.developers.google.com/codelabs/firebase-android/index.html?index=..%2F..%2Findex#2
How to get child of child value from firebase in android?
https://stackoverflow.com/questions/43293935/how-to-get-child-of-child-value-from-firebase-in-android?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qaQuerying Data
https://stackoverflow.com/questions/39024702/firebase-querying-data
DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
Query query = reference.child("issue").orderByChild("id").equalTo(0);
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
// dataSnapshot is the "issue" node with all children with id 0
for (DataSnapshot issue : dataSnapshot.getChildren()) {
// do something with the individual "issues"
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
For more reference:
Basic information
Comments
Post a Comment