firebase-realtime-database

How to write to the last child of a Firebase ref in Swift?

ⅰ亾dé卋堺 提交于 2019-12-23 03:32:34
问题 I am struggling with writing data to Firebase in the desired way. The situation: I want to store multiple "trips" for each user. Every "trip" contains locations with lat, long, altitude and a timestamp. On certain conditions, I want to add a new location to the most recent "trip". Data Structure is the following: - root -- users --- userID ---- trips ------ trip1 ------- location ------ trip2 ------- location What would be the best way to add locations to the most recent trip (trip2 in this

Adding data to a specific UID in firebase

試著忘記壹切 提交于 2019-12-23 03:32:25
问题 i've been trying to store user inputted data to the their personal uid in firebase but so far i've only been able to do this when the user created an account and what im trying to find out is how to store data from a text field in xcode to the firebase realtime database under a unique uid, that the user gets when they create an account?? for example: i have 3 textfields that will store the user information to the already assigned UID when they created the account at the start of the

Writing Firebase Database without using their auto generated key in Android

痴心易碎 提交于 2019-12-23 03:22:34
问题 I am using Firebase in my android project where every user will have his details stored like name, phone number, video_url, thumbnail_url etc. Now the way I have used it before in my previous projects is as shown in the pic- I did not use the Firebase's auto generated id/Hash but used email id instead. It was easier for me that way. But someone told me that it is unsafe to use emails instead of autogenerated hash/ids and the recommended way is to use hashes. So the question is, is it really

Unable to use FirebaseRecyclerAdapter

谁都会走 提交于 2019-12-23 03:18:08
问题 I am getting cannot resolve FirebaseRecyclerAdapter when trying to use it even after adding firebase ui in gradle dependency.Thanks in advance 回答1: Can you show your build.gradle file? Also, have you tried putting this under your package name in your java class: import com.firebase.ui.database.FirebaseRecyclerAdapter; ? 回答2: I was getting the same issue, it's resolved by adding the firebase-ui dependency in build.gradle (module:app) compile 'com.firebaseui:firebase-ui-database:0.4.0' Also add

Convert String of CLLocationCoordinate2D(s) into array

﹥>﹥吖頭↗ 提交于 2019-12-23 02:53:07
问题 Updating previous question for better explanation. var breadcrumbs: [CLLocationCoordinate2D] = [] var path: [CLLocationCoordinate2D] = [] This is called every 10 seconds to append a CLLocationCoordinate2D to the array. func addBreadcrumb(){ let speed = (locationmanager.location?.speed)! let speedRounded = speed.roundTo(places: 4) let crumbCoordinate = locationmanager.location?.coordinate breadcrumbs.append(crumbCoordinate!) tripSpeeds.append(speedRounded) } Once the user is done with their

how to sort in the new Firebase database reference (Recyclerview)

♀尐吖头ヾ 提交于 2019-12-23 02:48:05
问题 I am pulling data from a username structure and I would like to sort by name or username. Is this possible with the new firebase database reference. I have been looking around and I cannot find anything about it. here is my code: databaseReference = FirebaseDatabase.getInstance().getReference().child("Users"); } @Override protected void onStart() { super.onStart(); FirebaseRecyclerAdapter<addFriends,addFriendsViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<addFriends,

Firebase: How to retrieve data from two tables using id

◇◆丶佛笑我妖孽 提交于 2019-12-23 02:46:14
问题 I come from an SQL background and recently started using Firebase for building an ionic shopping cart. This is the database schema: To retrieve a user's cart, i used the following var user_id="user1"; // Temporary initialised var refCart = new Firebase("https://testing.firebaseio.com/cart"); var cart=$firebase(fireBaseData.refCart().child(user_id)).$asArray(); This gives the result: item1 1 item2 2 item3 5 So tried using foreach() var refMenu = new Firebase("https://testing.firebaseio.com

Firebase Leaderboard, best Implmentation. SQL Joins and orderby

烈酒焚心 提交于 2019-12-23 02:46:10
问题 I am creating a leaderboard app using Firebase as the database. I come from an old school SQL background so this new noSQL type of databasing is giving me database key and reference anxiety. If I have groups, each groups having members, and then all the users have scores for various tests, what is the most efficient way of getting the data for a group where the scores of a given test are displayed in order. In SQL this is obviously trivial using joins and then orderby but so far in the

Firebase retrieve/read returns null values - Android

狂风中的少年 提交于 2019-12-23 02:43:09
问题 Using Firebase docs for retrieving data with: ref.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot snapshot) { System.out.println(snapshot.getValue()); } @Override public void onCancelled(FirebaseError firebaseError) { System.out.println("The read failed: " + firebaseError.getMessage()); } }); Running the above produced: {users={facebook:###############={posts={-KE8qg1VyPAwYj0uJDcn={status=update1}}, provider=facebook, displayName=Some Name}}}

Firebase push() and set()

巧了我就是萌 提交于 2019-12-23 02:36:13
问题 I'm writing a bit of React code to push text to firebase and I've seen a couple different ways of doing this. I think the difference is set() overwrites the data at location while push will add it to the location under whatever is already there, however I then came across this.ref.push().set({text: text}); which uses both, so now I'm a bit confused what that does compared to just set() and push() Any help is appreciated 回答1: Calling ref.push().set({text: text}) in the Firebase JavaScript SDK