firebase-realtime-database

Generate 6 digit unique number in Firebase

社会主义新天地 提交于 2021-01-28 05:31:42
问题 I want to generate 6 digit unique number in Firbase (unique must) above attendeeCode should be unique on every new attendess entry I am new in firebase and I have searched alot but could not find 回答1: Create a six digit number that corresponds to the nth entry into attendees . And then keep track of that number elsewhere. You can find in other questions that Firebase still does not support COUNT or LENGTH queries. Create a path called /meta-data (arbitrary) and save the number of current

Auth with multiple firebase realtime databases on web not working

◇◆丶佛笑我妖孽 提交于 2021-01-28 05:26:17
问题 I have two Firebase realtime databases. I have managed to connect, read, and write to both of them from my web-based client. However, I am going back through my security rules and made it so you can only read/write if you are authenticated using "rules": { ".read": "auth.uid != null" , ".write": "auth.uid != null" } However, for some reason I am now unable to connect to the database, it says that permission is denied. I am authenticated on the client using Google, and everything else with

Comparing EditText string with firebase database's child value

不想你离开。 提交于 2021-01-28 05:08:37
问题 My app has a registration page wherein only those users who enter the right passcode are allowed to register. This passcode is stored inside firebase database inside a child called "Councilpasscodes". After entering the passcode the user should press the submit button, after comparing the two passcodes the user should be allowed to register if the passcodes are same. This is the code for comparing the edit text string and the child value: mpasscode=FirebaseDatabase.getInstance().getReference(

How to save LocalData in Firebase Realtime database?

懵懂的女人 提交于 2021-01-28 03:24:16
问题 I am very new using Kotlin and programming and I am currently making a calendar with events. My problem comes when I want to connect these events to firebase. I am using an example that I found in git (https://github.com/kizitonwose/CalendarView) that uses the ThreeTen library for dates. This is the Event object: class Event (val id: String, val text: String, val date: LocalDate) : Serializable The data variable is of the LocalData type and this is what is causing me problems since it seems

JavaScript array not iterable

邮差的信 提交于 2021-01-28 02:52:55
问题 I hit a really weird issue with a simple JavaScript array last night. I am working on a React Native app powered by Firebase and getting data from the real-time database with the SDK. Here is the code: var app = this this.props.fb.auth().onAuthStateChanged(function(user) { if (user) { app.props.fb.database().ref('/users/' + user.uid + "/timeline").once('value').then(function(snapshot) { var posts = snapshot.val() return posts }).then((posts) => { var statuses = []; for (i in posts) { app

Why i can't retrieve username and password from Firebase realtime database

牧云@^-^@ 提交于 2021-01-28 02:15:29
问题 I want to login using username and password that is stored in Firebase realtime database. But my code does not work. I include my database picture and code. Please help me. This is database image: This is my main activity code MainActivity.java databaseReference=FirebaseDatabase.getInstance().getReference("Client"); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Query query = databaseReference.child("Client").orderByChild("username").equalTo

flutter firebase how do I get all the children of a node

馋奶兔 提交于 2021-01-28 01:57:35
问题 I am not very familiar with using dart and firebase and I was wondering how I could get all the children of a certain node and how I could check if a node exists 回答1: Something like this should you get the list of users: static Future<int> getUserAmount() async { final response = await FirebaseDatabase.instance .reference() .child("Users") .once(); var users = []; reponse.value.forEach((v) => users.add(v)); print(users); return users.length; } You can check with users what you need to check

How to upload image to firebase storage and save reference in the database in single transaction?

两盒软妹~` 提交于 2021-01-27 23:46:19
问题 I would like to upload image to firebase storage and save link to it in the firebase database. Saving link to database can fail for whatever reason and then I have unused, unlinked image in the storage. Is it possible to somehow ensure that after upload link to the image is saved in the database? 回答1: This is another approach other than using transaction. You can use Firebase Cloud Functions Storage Trigger. You can write a cloud function to get the download URL of the uploaded image and then

Fetching details of a group user belongs to in firebase

喜你入骨 提交于 2021-01-27 23:20:33
问题 Below is my database structure in firebase . I only have signed-in users Id. User -userId -Name -age -groups groupId1:true groupId2:true Group -groupId -name -desc -UserId -UserId1:true -UserId2:true I want to list the details of all the groups that user belongs to. My approach is, Find all the groups my user belongs to by checking the index from User. Using the list of groupid we got from step1, get details of group from Groups. Is there any other better suggestions? 回答1: With your current

How to save new user data to Firebase Realtime Database after Login

丶灬走出姿态 提交于 2021-01-27 21:30:37
问题 I have written a function to write new user data if needed to database like this private void writeNewUserIfNeeded(final String userId, final String username, final String name) { final DatabaseReference usersRef = rootRef.child("users"); usersRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (!dataSnapshot.hasChild(userId)) usersRef.child(userId).setValue(new User(username, name)); } @Override public void