Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] java – Make identical node in firebase realtime database

Posted on November 14, 2022

Solution 1 :

I have tried the push() method but it generates different unique ids.

That’s expected behavior since calling push() multiple times, will always generate each time a new random id.

Will I have to use FirebaseAuth to make the unique id similar for “user data” & “user key”.

When it comes to users IDs, yes, the most appropriate solution is to implement Firebase Authentication and use the UID that is generated in this process. In the end, you can simply use the same UID, in every reference that you need, for example:

String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference userDataRef = rootRef.child("userData").child(uid); //One reference
userDataRef.setvalue(yourObject);
DatabaseReference otherUserDataRef = rootRef.child("otherUserData").child(uid); //Second reference
otherUserDataRef.setvalue(otherObject);

Problem :

Suppose there are two nodes:

  1. user data (inside “user data” we have:)

    unique id
    name: “abc”
    latitude: “123”
    longitude: “456”

  2. user key (inside “user key” we have:)

    unique id
    g: “awe46q”
    l
    0:123
    1:456

Here I want to save both “user data” & “user key” with the same unique id. But I don’t know how to do it.

Comments

Comment posted by Alex Mamo

What have you tried so far?

Comment posted by Bikram Khanikar

I have tried the push() method but it generates different unique ids. Will I have to use FirebaseAuth to make the unique id similar for “user data” & “user key”.

Comment posted by Bikram Khanikar

I tired out this and it was successfully saving “user data” & “user key” with same unique id(

Comment posted by Alex Mamo

Good to hear that 🙂 The

Comment posted by Bikram Khanikar

Thanks it is retrieving all data from

Comment posted by Alex Mamo

This is basically another question. In order to follow the rules of this community, please post another fresh question, so I and other Firebase developers can help you.

READ  [ANSWERED] android studio java mapping function for multiple IDs
Powered by Inline Related Posts

Comment posted by Bikram Khanikar

For sure Alex Mamo 🙂

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress