firebase-realtime-database

Getting a specific category of data from firebase

廉价感情. 提交于 2019-12-22 11:21:29
问题 I would like to categorize data in a Firebase realtime database and then select them by category to be displayed in different sections of my android views but I don't know where to start. I am new to Firebase all I know is how to pull data, push to Firebase db and display all the data fetched. My question is: is this possible and if yes how can I go about it? Thanks 回答1: If you have this database: Animals randomId name: dog category: mammal randomId name: snake category: reptile randomId name

Android Firebase multiple image upload

蹲街弑〆低调 提交于 2019-12-22 10:57:29
问题 I am writing an app to test out firebase where a user can list a product with images. I'm having issues with the upload as although the pictures are stored, they are not linked to the product (images array not being passed?) and LeakCanary signals an outofmemory error. All help and input appreciated. Here's my Product Model @IgnoreExtraProperties public class Product { public String uid; public String seller; public String name; public String description; public String city; public double

How to get the value of a class with generic type in property?

前提是你 提交于 2019-12-22 10:53:22
问题 I have a class Party public class Party { private String password; private String host; private String nextInLine; private String nextUp; private Track currentlyPlaying; private LinkedList<Guest> guestList; public Party() { // Default constructor required for calls to DataSnapshot.getValue(Post.class) } public Party(String password, String hostName) { this.password= password; this.host= hostName; LinkedList<Guest> newGuestList= new LinkedList<>(); newGuestList.put(hostName, new Guest(hostName

How to retrieve data from one single userID Firebase Android

怎甘沉沦 提交于 2019-12-22 09:51:27
问题 In my firebase database, I have list of users that have different information under them. I would like to retrieve information from a single userId, which I will define in the code and I want to only get information from that user. My data looks like; UserTable { "fmXWU324VHdDb8v6h7gvNjRojnu33" : { "-KbJtw467nl6p253HZ537" : { "Name" : "name1", "Email" : "something1@something.com", "userid" : "fmXWU324VHdDb8v6h7gvNjRojnu33" } }, "pJtC45fW0MMi352UiPWnWdIS7h88" : { "-Kb012ls9iMnzEL723o9I" : {

Datasnapshot HashMap cannot be cast to another class

吃可爱长大的小学妹 提交于 2019-12-22 09:36:22
问题 I have added the functionality to the app I am designing to get the List of all "Job_Class" objects from my Firebase database, this is working fine, I can get all the jobs. The issue is I need to use the collection of jobs I have retrieved however I am getting the error: java.util.HashMap cannot be cast to (packages removed).Job_Class This error occurs at the for loop you will see in the code below. If anyone could help me in being able to actually use the jobs retrieved I would be very

Swift & Firebase - Out of sync after isPersistenceEnabled

我只是一个虾纸丫 提交于 2019-12-22 09:30:02
问题 I have a problem with my connection between my app and firebase database. After adding: Database.database().isPersistenceEnabled = true To my AppDelegate, some of the data is out of sync. To get my data i use: self.ref?.child("Stores").observe(.childAdded, with: { (snapshot) in if let dictionary = snapshot.value as? [String: AnyObject] { let store = Store() store.Latitude = dictionary["Latitude"]?.doubleValue store.Longitude = dictionary["Longitude"]?.doubleValue store.Store = dictionary[

How to get string from firebase realtime db that contain in unique key

天大地大妈咪最大 提交于 2019-12-22 09:11:43
问题 I want to get a string from this: , but it has a unique key parent. How do I get string from db? I tried: firebaseAuth = FirebaseAuth.getInstance(); fUID =firebaseAuth.getCurrentUser().getUid(); itemsUrl ="https://nextweaverproject.firebaseio.com/users/" + fUID ; mDatabase = FirebaseDatabase.getInstance(); final DatabaseReference myRef = mDatabase.getReferenceFromUrl(itemsUrl); myRef.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot,

Firebase onDataChange not entered

六眼飞鱼酱① 提交于 2019-12-22 09:07:58
问题 In the setUser method, I am trying to read data from my database which I will use to create an instance of User, Worker, Manager, or Administrator.I also know that the following three lines of code are incorrect, but they don't raise any errors, so they can be ignored for now. String name = mUserDatabase.child(uniqueId).child("name").orderByValue().toString(); int zip = mUserDatabase.child(uniqueId).child("zipcode").orderByValue().hashCode(); String phone = mUserDatabase.child(uniqueId).child

Make sure to call FirebaseApp.initializeApp(Context) first. Default FirebaseApp is not initialized in this process com.example.login

二次信任 提交于 2019-12-22 08:38:38
问题 I am making a Firebase Authentication Signup Page using kotlin and there is a run time error while I am running the app. Please See the 3rd and 14th line I can't figure out what is the problem. I didnt attach the main code please inform me if the codes are necessary to attach. E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.login, PID: 7505 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.login/com.example.login.Register}: java.lang

Cloud Functions for Firebase database onWrite triggered twice

牧云@^-^@ 提交于 2019-12-22 08:35:13
问题 Hi I am developing a notification system, but I am having trouble deleting the processed notification data. The onWrite event listener is triggered twice resulting to two notifications. Can you help me find a work around so that onWrite event listener should not be triggered twice? It is important to delete the processed data. exports.sendMessageNotification = functions.database.ref('/notification/message/{recipientUid}/{senderUid}').onWrite(event => { /* processing notification and sends FCM