kuoa / nearby-chat

Nearby Chat is an app allowing users to visualize on a map, people in their near proximity and chat with them by sharing text, photos or audio files.
MIT License
29 stars 9 forks source link

Realtime Database not updating #35

Closed passenger-earth closed 3 years ago

passenger-earth commented 4 years ago

Thank you for your project. I learned a lot from it. I have a question. i connected the app the firebase console and was able to sign in new users. But i notice that the realtime database is not updating, no nodes are created. I checked the rules and made sure to have read and write to true. But i still cant get the realtime database to work. Can you help me?

W4lspirit commented 4 years ago

Hi @passenger-earth, It's been a while since I worked on this project, I'll check the issue tonight.

W4lspirit commented 4 years ago

Hi @passenger-earth , I think I found this issue, during this project I hardcoded(bad) the instance name of the firebase bucket (nearby-chat-a3151). As a result everytime we try to call firebase, this error will be log :

Caused by: java.io.IOException: { "error": { "code": 400, "message": "Permission denied. Could not access bucket nearby-chat-a3151. Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources.", "status": "ACCESS_BUCKET" }}

public static final String FIREBASE_STORAGE_REFERENCE = "gs://nearby-chat-a3151.appspot.com";`

If you have custom bucket you can just replace the constant value, but if you are just using the default bucket given by firebase. You can remove the constant from the code since FirebaseStorage.getInstance() will retrieve it for you.

The constant can be removed from DatabaseUtil.java:71 and OnlineActivity.java:166

I did some tests on a new instance and I have some data stored in my bucket 🏆 Screen Shot 10-06-20 at 01 12 AM

Let me know if the issue is resolved.