firebase-realtime-database

Pagination using startAt() when ordering by child

淺唱寂寞╮ 提交于 2020-01-05 04:29:14
问题 I am trying to just retrieve a list of records, sorted by one of the fields in each record, and I would like to be able to retrieve the data in pages. According to the Firebase documentation, the reference.startAt() method has an optional 2nd parameter, which is: The child key to start at. This argument is only allowed if ordering by child, value, or priority. First off, here is the data: { "products" : { "-KlsqFgVWwUrA-j0VsZS" : { "name" : "Product 4", "price" : 666 }, "-Klst-cLSckuwAuNAJF8"

TextView with data from firebase rt dababase disappear on screen - 2nd qustion

这一生的挚爱 提交于 2020-01-05 04:27:08
问题 I'm trying to get a user name from the database and set it as text on the screen. I have 3 Activity and Fragment objects. I'm trying to get name of the user in main activity: The first activity is a login activity that have user sign in and sign up functions with firebase auth integration. After that , if sign in or sign up success , Splash activity is open. in splash activity , i should get user display name (). In the () function i'm creating a new user object and setting the display name.

Firebase: How to structure data for the most shared posts in the last n days?

冷暖自知 提交于 2020-01-05 04:24:31
问题 Let's assume there is a blog and you would like to list the most liked or shared posts for today, the last 7 days and the last 30 days. The solution for today is rather easy: -mostSharedPostsForToday -2018-10-08 -$postId -numberOfShares Then the query would observe mostSharedPostsForToday/2018-10-08 for today's most shared posts ordered by child numberOfShares . But how to structure the data for the most shared posts in the past n days? One solution I can think of is to write a cloud function

Fetching Json from firebase as string not working in java

给你一囗甜甜゛ 提交于 2020-01-05 04:24:07
问题 Firebase data using rest: FireBase data in console: Java code to fetch data from firebase PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); cm.setMaxTotal(100); cm.setDefaultMaxPerRoute(100); httpClient = HttpClients.custom() .setConnectionManager(cm) .build(); CloseableHttpResponse response; try { String url = "https://testcustom-a1a4d.firebaseio.com/1719126/1719130/1719121.json?auth=myauthId"; HttpGet httpGet = new HttpGet(url); response = httpClient.execute

Firebase database sort by deeper child

…衆ロ難τιáo~ 提交于 2020-01-05 04:11:09
问题 Considering the following structure of the Firebase database: root game1 $playerUidA score: 50 $playerUidB score: 10 ..... game2 $playerUidC score: 20 $playerUidD score: 30 ..... game3 ..... I want to run a query that will return all game nodes, where the children of each game node (the players) will be sorted based on the score . The game node contains the UID of each player, and each UID node contains the score of the player. I am storing other data as well, however, for the sake of this

Update that object with the new info in array and to display tableview Swift

﹥>﹥吖頭↗ 提交于 2020-01-05 04:11:09
问题 I am using firebase realtime database and implementing user profile data with usersFriend and location. I need to implement the update in object array and show updated values in tableview. I have tried but I am not successful in updating object and then tableview reload. Function already developed. I need to show updated object array swapped with new values and display in tableview. var myFriendsDataSource = [FriendClass]() func watchForChangesInMyFriends() { let usersRef = self.ref.child(

Firebase - what is the most efficient way to check if an email is registered?

梦想与她 提交于 2020-01-05 03:44:05
问题 I'm trying to write a function that will check to see if an email is registered with my Firebase app (with Javascript/Web), before proceeding with the sign up process (if the email isn't registered). I created a node named active_emails which I wanted to populate with registered emails (like an array). I was going to check the email against this list and if it didn't exist then I would allow the user to proceed with the registration process. I see from the answer here: Proper way to store

Is there a way to set specific error messages on validation rules? [duplicate]

送分小仙女□ 提交于 2020-01-05 03:23:26
问题 This question already has an answer here : how can i know what security firebase rule give me a error? (1 answer) Closed last year . Let's say that I have a validation rule like "validate": "condition1 && condition2" and I want to show the user an error message according to the first condition that is not met. For example, if condition1 isn't met, the user would receive a custom message saying that "Condition1 is not met". Basically, I want to map an error code (or message) to each condition

How to get only the new items added to firebase?

孤者浪人 提交于 2020-01-04 15:25:24
问题 I'm developing an Android application and it's using the firebase to fetch its data. The onChildAdded() method in Firebase triggers off for all the children. Is there any hack to just get the newly added child alone? PS: Each of the child has a date with it. 回答1: You could save the last date you updated and then use it as reference to filter what is new. 来源: https://stackoverflow.com/questions/36648907/how-to-get-only-the-new-items-added-to-firebase

StackoverflowError when using Firebase

感情迁移 提交于 2020-01-04 11:03:48
问题 I'm currently trying to make an app that will show you a position on a map whilst also saving it to Firebase for later use. This is my MapsActivity: public class MapsActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener { GoogleMap googleMap; LocationRequest mLocationRequest; GoogleApiClient mGoogleApiClient; Marker marker; Intent intent; DatabaseReference myRef; FirebaseDatabase