[Solved] Remove value from database using Cloud Functions

[ad_1] You are returning from the function before calling remove. Try: return oldItemsQuery.once(‘value’, function(snapshot) { // create a map with all children that need to be removed var updates = {}; snapshot.forEach(function(child) { updates[child.key] = null }); // execute all updates in one go and return the result to end the function return ref.update(updates); }).then(function() … Read more

[Solved] Upload an image from device to firebase

[ad_1] Well, I don’t know whats going on but, this works for me, Make sure your pods has at least these in there. PODFILE pod ‘Firebase/Storage’ pod ‘Firebase/Auth’ #Auth isn’t needed but, you should really use it. View controller import UIKit import FirebaseStorage class TestView: UIViewController { var imageView: UIImageView! override func viewDidLoad() { super.viewDidLoad() … Read more

[Solved] Fetch all children from database

[ad_1] This answer is similar to a prior answer here What you want to do is to treat each child in Customers as a DataSnapshot, then the children can be accessed. Given a Firebase structure: usersDatabase uid_0 Customers Ben Smith data: “Some data” Tom Cruise data: “Some data” uid_1 Customers Leroy Jenkins data: “Some data” … Read more

[Solved] Second If statement gets called before first statement finished in one function

[ad_1] Asynchronous methods! You have to wait for the completion before you move on to the next step. Put the second block within the first completion handler – like this func pictureFromFirebase(loginMethod: Int) { if loginMethod == 0 //FB { var profilePic = FBSDKGraphRequest(graphPath: “me/picture”, parameters: [“height”:300, “width”:300, “redirect”:false], httpMethod: “GET”) let profilePicRef = storageRef.child((user?.uid)!+”/profile_pic.jpg”) … Read more

[Solved] Firebase Query help me

[ad_1] To solve this problem, move the declaration of your final int[] ndomande = {14}; array inside the onDataChange() method, otherwise it will be always null. public void onDataChange(DataSnapshot dataSnapshot) { //Toast.makeText(PlayTest.this, “FIN QUI “,Toast.LENGTH_SHORT).show(); final int[] ndomande = {14}; for (DataSnapshot messageSnapshot : dataSnapshot.getChildren()) { //Toast.makeText(PlayTest.this, “QUI “,Toast.LENGTH_SHORT).show(); long numero_domande = (long) messageSnapshot.getValue(); ndomande[0] … Read more

[Solved] I keep getting java.lang.String com.google.firebase.auth.FirebaseUser.getUid()’ error although it has already confirmed they is a user

[ad_1] I keep getting java.lang.String com.google.firebase.auth.FirebaseUser.getUid()’ error although it has already confirmed they is a user [ad_2] solved I keep getting java.lang.String com.google.firebase.auth.FirebaseUser.getUid()’ error although it has already confirmed they is a user

[Solved] Android Frebase User Data Retrieve [closed]

[ad_1] In your Database Reference make sure you are having the correct path to the data your are retrieving, like DatabaseReference ref = FirebaseDatabase.getInstance().getReference().child(“your/path/to/data”); ref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { //making sure snapshot consists some data if (dataSnapshot.exists()) { //do your stuff User userDashboard = dataSnapshot.getValue(User.class); USERNAME.setText(userDashboard.getName().toString().trim()); PASSWORD.setText(userDashboard.getPassword().toString().trim()); EMAIL.setText(userDashboard.getEmail().toString().trim()); } } … Read more

[Solved] What’s wrong in this code for firebase database? [closed]

[ad_1] You need to change this line of code: mDatabaseReference.child(“drivers”).child(userid).toString() != userid || mDatabaseReference.child(“parents”).child(userid).toString() != useremail) { with mDatabaseReference.child(“drivers”).child(userid).getRef().toString() != userid || mDatabaseReference.child(“parents”).getRef().child(userid).toString() != useremail) { As you probably see, i have added the getRef() method to actually get the reference. Hope it helps. 7 [ad_2] solved What’s wrong in this code for firebase database? … Read more

[Solved] Item gets duplicated in adapter, when we delete or update item from Firebase Realtime Database

[ad_1] This Solution work for me : This code will remove last item in adapter after performing deletion operation in firebase realtime database. mAcceptedList.removeAt(adapterPosition); mShortlistProfileAdapter.notifyDataSetChanged() override fun onItemClicked( adapterPosition: Int, mUserListProfile: ArrayList<UserProfile> ) { mShortlistedProfileVM?.deleteUserProfile(mUserListProfile.get(adapterPosition)) mAcceptedList.removeAt(adapterPosition); mShortlistProfileAdapter.notifyDataSetChanged() } } To Prevent item gets duplicated. Clear your list before adding data into list. mAcceptedList.clear() <—add this … Read more

[Solved] how to retrieve all the keys in firebase android

[ad_1] All You have to do is do a nested query .! first find key of parent then get pass that key to next query and then find its children.! List<user> userList=new ArrayList(); mdatabaseRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot child: dataSnapshot.getChildren()){ String key = child.getKey(); fun(key); } private void fun(String … Read more

[Solved] Only the last element is shown in Firebase database

[ad_1] What your code doing is just replacing the current text in the TextView with the factdata.getFactDetail(). For example you have 3 elements 1, 2, and 3. Then you want to display the element inside the TextView. With your code, this is what happen First iteration: element = elements[0]; // element = 1 factViewBox.setText(element); // … Read more