Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+14 votes

When I made the bird counter app for myself, I was able to implement a real time database for one user but not all users. I think it may be a simple task but will need some research. Let me know if you have any ideas.

asked in CSC490_Spring2019 by (8 points)
+3

I was trying to follow this tutorial: https://firebase.google.com/docs/android/setup but could not get it work. Let me know if you find a better tutorial

1 Answer

+4 votes
 
Best answer

You can create a collection of user documents using firebase's authentication to obtain either their user id created from authentication or their email. For the bird counter you probably did not have authentication, but for other projects, you probably will want to use firebase's authentication. If you are using firestore (I do not know if this is true in firebase's realtime database) you can create a reference to another collection in a document that could be referenced using:

firestore.collection("users").doc([user id or email]).collection([name of collection])

This would give you the reference to user's documents and allows for generalization of getting any logged in user's documents that need to get used. I do not know if this is the exact same syntax for android studio, but it worked for me in React.

Here is a link that may tell you how to do it in your project
https://firebase.google.com/docs/firestore/query-data/get-data

answered by (8 points)
selected by
...