firebase-realtime-database

Understanding conflict resolution in firebase

时光怂恿深爱的人放手 提交于 2021-02-07 02:56:28
问题 I'm trying to understand the way the conflict resolution works in firebase for which I need some help. Assuming that I've json object saved in a node in firebase realtime: { "shape": "rectangle", "stroke": 10, "color": "black" } I've defined a test page which reads this data and displays and also listens to the changes happening on node with key in realtime. I've added a provision to update the data which eventually updates the specific key value alone. Sample used case client 1 - loads the

Understanding conflict resolution in firebase

馋奶兔 提交于 2021-02-07 02:56:00
问题 I'm trying to understand the way the conflict resolution works in firebase for which I need some help. Assuming that I've json object saved in a node in firebase realtime: { "shape": "rectangle", "stroke": 10, "color": "black" } I've defined a test page which reads this data and displays and also listens to the changes happening on node with key in realtime. I've added a provision to update the data which eventually updates the specific key value alone. Sample used case client 1 - loads the

Firebase persistence, clear Firebase cache

旧城冷巷雨未停 提交于 2021-02-05 17:55:39
问题 My app uses Firebase to sync and restore data. I use the setValue:withCompletionBlock: method to insert, update and delete Firebase objects. This method is called whenever there is a CoreData save, thus syncing all my local changes to Firebase - (void) setValue:(id)value withCompletionBlock:(void (^)(NSError* error, Firebase* ref))block; Now syncing uploads all the local data to firebase, while restore replaces the local data with firebase data. - (void) observeSingleEventOfType:(FEventType

Detect value change with firebase ValueEventListener

巧了我就是萌 提交于 2021-02-05 12:13:36
问题 I am trying to detect value change from my Firebase Database. Here is my code for initializing the ValueEventListener: valueEventListener = new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { try { String customerLocation = String.valueOf(dataSnapshot.getValue()); Point customerPoint = locationFounder.getPoint(customerLocation); if (customerPoint != null) { databaseReference.child("isActive").addValueEventListener(new ValueEventListener() {

Detect value change with firebase ValueEventListener

99封情书 提交于 2021-02-05 12:13:34
问题 I am trying to detect value change from my Firebase Database. Here is my code for initializing the ValueEventListener: valueEventListener = new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { try { String customerLocation = String.valueOf(dataSnapshot.getValue()); Point customerPoint = locationFounder.getPoint(customerLocation); if (customerPoint != null) { databaseReference.child("isActive").addValueEventListener(new ValueEventListener() {

Detect value change with firebase ValueEventListener

泪湿孤枕 提交于 2021-02-05 12:13:23
问题 I am trying to detect value change from my Firebase Database. Here is my code for initializing the ValueEventListener: valueEventListener = new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { try { String customerLocation = String.valueOf(dataSnapshot.getValue()); Point customerPoint = locationFounder.getPoint(customerLocation); if (customerPoint != null) { databaseReference.child("isActive").addValueEventListener(new ValueEventListener() {

Customize IDs into Firebase Realtime Database [duplicate]

ε祈祈猫儿з 提交于 2021-02-05 12:09:41
问题 This question already has an answer here : Post request to firebase without unique key (1 answer) Closed 1 year ago . I'm using Firebase Realtime Database integrated in a mobile app and web panel. By default, a unique ID on Realtime DB is generated on this format: -Lup7ey2xRPO9Owm67xM When creating new register through the Firebase panel, i can customize the unique id with GUID. { "0a921e40-5959-43bc-b2be-a65f6712288d": { "name": "Test" }, } However, after call Rest API, with Postman or on my

How to use a value outside dataSnapshot function?

放肆的年华 提交于 2021-02-05 12:08:23
问题 In the code below i get the number of children but i want to use it outside the onDataChange method. mRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { DateStorage dateStorage = null; for (DataSnapshot result : dataSnapshot.getChildren()) { Log.e(result.getKey(),result.getChildrenCount() + ""); in[0] = result.getChildrenCount(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); Can anyone help me? 回答1:

How to use a value outside dataSnapshot function?

喜夏-厌秋 提交于 2021-02-05 12:05:22
问题 In the code below i get the number of children but i want to use it outside the onDataChange method. mRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { DateStorage dateStorage = null; for (DataSnapshot result : dataSnapshot.getChildren()) { Log.e(result.getKey(),result.getChildrenCount() + ""); in[0] = result.getChildrenCount(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); Can anyone help me? 回答1:

How to use a value outside dataSnapshot function?

眉间皱痕 提交于 2021-02-05 12:04:41
问题 In the code below i get the number of children but i want to use it outside the onDataChange method. mRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { DateStorage dateStorage = null; for (DataSnapshot result : dataSnapshot.getChildren()) { Log.e(result.getKey(),result.getChildrenCount() + ""); in[0] = result.getChildrenCount(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); Can anyone help me? 回答1: