firebase-realtime-database

Firebase database and app localization

我怕爱的太早我们不能终老 提交于 2020-01-03 08:21:26
问题 I am building a quiz game for both iOS & Android platforms and I want to be able to handle localization. I am using Firebase's realtime database solution in order to pull all of the question the game is going to have. I am hardcoding the questions into the Firebase's database and every question object has 2 parameters: ID - Obviously Text - The question text itself e.g. "Who was John Kennedy?" I am having hard time thinking about how to localize the questions I am pulling from Firebase.

Populating a ListView with firebase data in android

别说谁变了你拦得住时间么 提交于 2020-01-03 05:56:11
问题 I am back with this question again, I am close though: I have the following code which I am trying to show the firebase values in a list view. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mystatement); listview = (ListView) findViewById(R.id.listview); textView4 = (TextView) findViewById(R.id.textView4); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, list); listview.setAdapter

Android, get value from firebase database

允我心安 提交于 2020-01-03 05:53:07
问题 I need to add markers from all users on my map. I'm saving all coordinates in my firebase My database looks like: So, when I want to get values: lat, lng from database(I do it in onMapReady method): int allUsers = 100; while(allUsers >= 0) { double latAll = Double.parseDouble(users.child("lat").toString()); double lngAll = Double.parseDouble(users.child("lng").toString()); mMap.addMarker(new MarkerOptions().position(new LatLng(latAll, lngAll))); } I get an error Here i'm saving values ito my

How to download image from firebase database, and load it into image in unity

故事扮演 提交于 2020-01-03 05:33:31
问题 I use Firebase Realtime database to handle some of the UI in my Unity mobile application. I save and retrieve data from my database without any problems. The problem comes when i want to load an image from Firebase Storage. I have saved the URL's and names of the images' on my server, and now i try to Instantiate a prefab. This prefab contains a panel with text and an image for each Firebase-child. The structure of the image i try to load from my database looks like this: So in my code I go

how to limit star-count on Firebase?

泪湿孤枕 提交于 2020-01-03 05:07:13
问题 I am writing an anonymous social media app with a universal feed. I want to limit the likes on a post to one per user, but I don't know how to limit the likes of each user. This is my current code: class story var text = "" var numberoflikes = 0 var user = Auth.auth().currentuser! iboulet weak var : likebutton : uibutton iboulet weak var: storylabel : uilabel var story: story! { didSet { storylabel.text = story.text likebutton.setTitle(" /("story.numberoflikes)", for: []}} } ibaction func

Parsing Firebase JSON with Python

蓝咒 提交于 2020-01-03 04:52:06
问题 I'm working with the following JSON structures { "-L6Tr0Wl5fuG3tDgUPCa": { "List": "{'x': [0.02245, 0.02196], 'y': [0.96941, 0.97014], 'z': [0.05344, 0.05368]}", "Index": "17361" }, "-L6Tr4j05NV6BJKcaRSe": { "List": "{'x': [0.03196, 0.01537], 'y': [0.96795, 0.96966], 'z': [0.05051, 0.04929]}", "Index": "17362" } } The name of each entry is random (e.g. L6Tr0Wl5fuG3tDgUPCa) that is generated by firebase whenever we push a new entry. What is the best way to parse and iterate through each entry

How to import a Json arrays without overwriting existing objects in the FireBase RealTimeDB

可紊 提交于 2020-01-03 04:44:07
问题 I import a large amount of JSON files to my FireBase DB console with this feature: https://github.com/firebase/firebase-import It works well when I upload arrays with lots of objects, but if i want to upload a new array object to existing table, it overrides the existing object instead of adding the new one. I would be happy to find a right way to "Update" the new objects to the existing table with firebase-import or any other tool. 回答1: As pointed out by Jen, you can use the Firebase CLI to

Swift Firebase Check if user exists

给你一囗甜甜゛ 提交于 2020-01-03 04:39:42
问题 What am i doing wrong? I have a database structure like the one shown in this image. In appleDelegate.swift i just want to check if a certain user token actually exists under the "users" node. that is, if "users" has the child currentUserID (a string token). I understand observeSingleEvent is executed asynchronously.I get this error in swift: 'Application windows are expected to have a root view controller at the end of application launch'. in "func application(_ application: UIApplication" i

Run 2 TransitionBlocks in Swift (Firebase)

我是研究僧i 提交于 2020-01-03 03:18:05
问题 My app currently uses Firebase as its backend. Currently, I'm using a transitionBlock to updated a value in my database. I'd like to run another transitionBlock after the first one finishes. Any idea how to do this? Code: self.ref.child("blah").child(codeSelected).runTransactionBlock({ (currentData: FIRMutableData) -> FIRTransactionResult in if var post = currentData.value as? [String : AnyObject], let uid = FIRAuth.auth()?.currentUser?.uid { print(post) var totalCount = post["total"] as? Int

How to query Firebase database object when criteria property is nested?

岁酱吖の 提交于 2020-01-03 03:06:26
问题 I have the following structure in Firebase database: root - Users - Posts - -K_54s1smPPh6qN4znuT - key1: val - key2: val - User: - -K_54sSomeKeyFromUsersObject: "John Doe" ... But I can't find any example in documentation how can I fetch all Posts by UserKey when I have structure like this. I need help on how to make a query to compare nested data like this? 回答1: One way to approach this is to save the reference to the posts on the user. Like this: root - Users - [UserID] - UserPosts -K