Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Can we achieve by querying snapshots of all documents in a collection that seen and whose values are set to be false using for loop? Or will we have to use firebase functions for that? Thank you.
For ChatApp you can add a is seen attribute to your message like the below:
-La42yee6vzxZ2hbZy2R
isseen: true
message: "u"
reciever: "7bVO6TsEJtTPaO2bRqWL6ZzFrkg1"
sender: "4z27uqrIVCMJ96hfI6Y5qzIxHav1"
When the sender send a new message you must set isseen property to false, and when the receiver opens the chat page you must change isseen to true.
I hope this work for you.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Currently, I am writing a cloud function, i need a way to get the device id tokens of some devices, which i have stored in a field of a collection in a document.
How can I access it?
Please help, i'm stuck at this.
You can try code:
firebaseMessaging.getToken().then((token) {
Firestore.instance.collection('collectionName').document(currentUserId).updateData({'pushToken': token});
})
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
While it is super cool to work with Firebase in Unity, it is quite a learning curve.
Two questions have come up that I think are both general and important in the way Firebase is used:
Can any Firebase developers enlighten these?
If you set a Firebase Query to null, will it also set all listener events attached to that query to null?
Can you always use -= to remove an eventhandler, EVEN if this is not set? Is there a way to check if a query already has an Eventhandler (like ValueChanged) attached?
Best regards
Ole
you set a Firebase Query to null, will it also set all listener events attached to that query to null?
No. You will need to explicitly remove the listeners as shown here: How to remove all eventhandler
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Flutter Firebase realtime once().then() doesn't get updated when rerun
when I use once.then to read data if I run it again it won't update variables or give out null
The once() method does precisely what its name implies: it reads the data once, and doesn't monitor for updates. As the documentation says:
Listens for a single value event and then stops listening.
To get realtime update, use one of the on... streams such as onValue which:
Fires when the data at this location is updated.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Using Firebase as a backend for my mobile app, how can I get the information (on the client side) if a user was using my mobile-app within the last 4 weeks or if he didn't?
I somehow need to get the date of last usage (last read, or write operation, last login...)
I know there is the information of "last sign-in" in the admin SDK, however I'm not sure if this is supposed to be integrated in the app itself.
you can add lastOnline field to your user entity and change it everytime the user quit the application :
DatabaseReference userLastOnlineRef = FirebaseDatabse.getInstance().getReference("users/joe/lastOnline");
userLastOnlineRef.onDisconnect().setValue(ServerValue.TIMESTAMP);
link
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
just wondering how to retrieve data writed by a specific user using angular2 and firebase without using filter and map. if there is a way.
I think that you could use the equalTo query:
var ref = new Firebase('https://something.firebaseio.com/posts');
ref.orderByChild('sender').equalTo('some user').on("child_added", (snapshot) => {
console.log(snapshot.key());
});
In this case, a sender attribute must be present
See this link for more details:
https://www.firebase.com/docs/web/api/query/equalto.html