firebase

Flutter app crashes on concurrent transactions performed on cloud Firestore

北慕城南 提交于 2021-02-18 17:49:31
问题 I am trying to develop an app where multiple users log in and completes a poll concurrently. In this, as soon as user submits the answer the transaction is ran to increment the counter for given answer try { DocumentSnapshot freshsnap = await tx.get(reff); try { await tx.update(reff, <String, dynamic>{ '$i': freshsnap['$i'] + 1, }); } catch (error) { print("Error" + error.code); } } catch (error) { if (error is PlatformException && error.code == 'Error performing transaction') { // await tx

Firebase analytics not give more than 30 minutes data

可紊 提交于 2021-02-18 17:44:27
问题 I implemented firebase to my Unity game. I use event tracking code as in the format of: Eventname(eventid, eventparameter, parametervalue) Eventid-> something like 'level1_1' Eventparameter -> different parameters in eac case, 'gameovertype', 'winscore' etc Parametervalue -> string or number for different cases I am testing since 2 weeks and I have following problems: 1- Stremview show user data that I needed(gives parameter values and track each user) but it stores users for 30 minutes and

Firebase analytics not give more than 30 minutes data

六眼飞鱼酱① 提交于 2021-02-18 17:44:11
问题 I implemented firebase to my Unity game. I use event tracking code as in the format of: Eventname(eventid, eventparameter, parametervalue) Eventid-> something like 'level1_1' Eventparameter -> different parameters in eac case, 'gameovertype', 'winscore' etc Parametervalue -> string or number for different cases I am testing since 2 weeks and I have following problems: 1- Stremview show user data that I needed(gives parameter values and track each user) but it stores users for 30 minutes and

How to distinguish between the reasons Firebase Transactions return null?

僤鯓⒐⒋嵵緔 提交于 2021-02-18 15:01:13
问题 From my understanding of Transactions, it can return null for two reasons: There is actually no value at the node where the transaction is being performed. The local cache is empty as Firebase Cloud Functions is stateless. Therefore, it may return null the very first time and it will re-run the function. My question is, how do we distinguish between these two cases? Or does firebase do the distinction by itself? Myref.transaction(function(currentData) { if(currentData != null) { return

Return nested collection from firestore as object for angularfire2 and firebase

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-18 12:47:08
问题 Let's say you have the following structure: shopping-carts (collection) - shopping-cart 1(doc) -- dateCreated (field) -- items (collection) - shopping-cart 2(doc -- dateCreated -- items . . . So, how would we go about getting the entire shopping-cart(doc) as an ShoppingCart object that we defined as export interface ShoppingCart { items: ShoppingCartItem[] dateCreated: string } afs.doc('shopping-cart/id').valueChanges() only returns the dateCreated afs.doc('shopping-cart/id').collection(

Dynamic Image resizing for firebase storage

旧街凉风 提交于 2021-02-18 10:41:34
问题 Is there an efficient method to serve dynamic size images stored in firebase storage through changing Query parameter in image URL? Or something like Imgix? what is the most efficient method? 回答1: I recommend You try this Cloud Functions for Firebase Storage resizing using ImageMagick Writing a Cloud Storage Trigger with Cloud Functions for Firebase sample code generate thumbnail 回答2: I use the following technique on my firebase project to do just what you are asking. Google cloud has a

How can I access a specific folder inside firebase storage from a cloud function?

怎甘沉沦 提交于 2021-02-18 08:40:08
问题 I am using firebase cloud function storage for the first time. I succeeded to perform changes on the default folder by using : exports.onFileUpload = functions.storage.bucket().object().onFinalize(data => { const bucket = data.bucket; const filePath = data.name; const destBucket = admin.storage().bucket(bucket); const file = destBucket.file(filePath); but now I want the function to be triggered from a folder inside the storage folder like this How can I do that? 回答1: There is currently no way

Firebase Realtime Database Pricing with Query

流过昼夜 提交于 2021-02-18 08:07:50
问题 I have a question about the firebase database pricing. I have about 400,000 rows in the leaderboard of my database, but in my app I just want to load the last 500 rows, so my question will I get charged for the 500 rows loaded when I run the query or will I get charged for all 400,000 rows. Realtime database charges 5$ per gb stored and 1$ per gb downloaded. I did the calculation with Firestore and found that Realtime Database would be way cheaper if i get charged for the 500 rows and not the

Firebase Auth Internal Error on login attempt

穿精又带淫゛_ 提交于 2021-02-18 07:40:17
问题 We are an app that uses firebase to create and sign in users. The sign in worked fine before, but recently it started giving an "Internal Error" (in the picture below) whenever we try to sign in with an email and password I checked to make sure that the sign in method (email and password) was enabled on firebase FIRAuth.auth()?.signIn(withEmail: signInEmail.text!, password: signInPassword.text!, completion: { (user, error) in if(error == nil) { print("SUCCESS: User authenticated with firebase

How to update Firebase token in Flutter application after it expires and store it?

本小妞迷上赌 提交于 2021-02-18 07:25:34
问题 I have created authentication with google on first time start up of app and I have my own _authenticatedUser which stores user token for further requests. final FirebaseAuth firebaseAuth = FirebaseAuth.instance; final GoogleSignIn googleSignIn = GoogleSignIn(); Future<String> signInGoogle() async { GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn(); GoogleSignInAuthentication gsa = await googleSignInAccount.authentication; FirebaseUser user = await firebaseAuth