firebase-realtime-database

Firebase Database Structure - Users, Groups and Lists

泄露秘密 提交于 2019-12-25 17:16:05
问题 I am planning a mobile application to use Firebase as its database/authentication provider mainly because I have found the authentication really easy to implement and also because of the apps nature. The app itself revolves around users in groups. Within each group is a range of data that will be accessible by every user in that group. I am wanting some feedback on my proposed firebase database structure and if there is anything I should do differently or could do better. Current proposed

HashMap is null so i cant get my data shown in the emulator from Firebase database

混江龙づ霸主 提交于 2019-12-25 17:14:07
问题 Android studio showed a warning so with ALT + ENTER the code val name = data[USERNAME] as String became val name = data?.get(USERNAME) as String but my emulator is still crashing thoughtsCollectionRef.get() .addOnSuccessListener { snapshot -> for(document in snapshot.documents){ val data = document.data //this is my code after listening to android studio val name = data?.get(USERNAME) as String val timestamp = data?.get(TIMESTAMP) as Date val thoughtTxt = data?.get(THOUGHT_TXT) as String val

HashMap is null so i cant get my data shown in the emulator from Firebase database

跟風遠走 提交于 2019-12-25 17:13:45
问题 Android studio showed a warning so with ALT + ENTER the code val name = data[USERNAME] as String became val name = data?.get(USERNAME) as String but my emulator is still crashing thoughtsCollectionRef.get() .addOnSuccessListener { snapshot -> for(document in snapshot.documents){ val data = document.data //this is my code after listening to android studio val name = data?.get(USERNAME) as String val timestamp = data?.get(TIMESTAMP) as Date val thoughtTxt = data?.get(THOUGHT_TXT) as String val

Current User is Null even if the App is in a different Activity

谁说我不能喝 提交于 2019-12-25 17:06:31
问题 I am facing (again) a null object error. My App compiles just fine but after the splashscreen the App crashes with showing the Logcat I posted down there. The Error occurs in my Home Activity. The Interesting thing is that I had cases when the App was running like it should be with also putting the Common.currentUser.Name correctly. That was directly after the registration of a new user, which means the Code is working. Now to my questions; How can I initialize the current User in my

How can I count the number of posts from another user? [duplicate]

浪子不回头ぞ 提交于 2019-12-25 17:03:32
问题 This question already exists : How can I count the number of user from collection join to another collection firebase real time not firstore and angular 8 [closed] Closed 2 days ago . In my application I am using the Firebase Realtime Database and each user can make one or more posts. These posts are stored under /posts and each post contains a userId object. How do I make a query to count the number of posts made by a particular user with this database structure? I am using Typescript &

Get a value from Firebase and update it with the current value + 1

≯℡__Kan透↙ 提交于 2019-12-25 16:52:02
问题 So yeah the title has the question. A little information this is what my Firebase database looks like: And this is the current code: export function updateQTY(barcode) { database.ref('items/' + barcode).update({ qty: currentQTY(barcode) }) } export function currentQTY(barcode) { database.ref('items/' + barcode).once('value').then(function(snapshot) { var qty = snapshot.val().qty console.log(qty) }) return qty + 1 } Basically, What I want is for the qty + 1 to be returned to the function

Error while adding data in userID in Firebase Swift 3

不问归期 提交于 2019-12-25 16:46:13
问题 I am trying to add data by respective userIDs in Firebase by sign up the user, but it gives me error " unexpectedly found nil while unwrapping an optional value " now I don't know what the matter is. But when I use code without adding userID in ref respectively the data is added successfully. but when I add userID following ref then got error. SignUp let userID = FIRAuth.auth()?.currentUser?.uid ref.child("user_registration").child(userID!).setValue(["username": self.fullName.text, "email":

Auto increment data on firebase

Deadly 提交于 2019-12-25 16:42:16
问题 I am currently trying to create something like this on Firebase: "Assets": { "asset001" : { "name": "DESK001", "owner: "owner's name", "brand: "HP", }, "asset002" : { "name": "NOTE001", "owner: "owner's name", "brand: "Dell", }, ... } But, i dont know how to automatically increment the value on "asset001"... i have seen the push() method, but then i wouldn't know how to retrieve the data. Here's what i have so far: JavaScript //Get the inputs ID from HTML var inputName = document

Firebase one of two observers not working

无人久伴 提交于 2019-12-25 16:07:28
问题 I have two observers, the second observer is dependent on the first observers value. I can't seem to get the first observer to work, I am not getting any errors on Xcode. The first function has to check the Users profile for information and then use that information to search for different information in the database. Here is my code: func loadposts() { ref = Database.database().reference() let trace = Performance.startTrace(name: "test trace") trace?.incrementCounter(named:"retry") let

Manual approval / rejection of user registration by admin using Firebase

心已入冬 提交于 2019-12-25 15:54:06
问题 Currently I'm designing an application in Swift 3.0 that will be used by a small group up to 100 users. Users will register through a simple registration form using email id and password but Admin will have to approve or reject the user registration request manually. Workflow I can think of is if a user register, admin will get some notification or email that a new user registration request is there and then when admin approve or rejects the user registration request and user will get a email