google-cloud-firestore

Changing profile photo using Firebase. Photo uploads successfully but the picture doesn't stay

廉价感情. 提交于 2020-08-10 20:20:13
问题 I've been following a tutorial on how to create a social app and I followed how to upload a post, but the tutorial didn't cover how to upload a new profile picture. So this is what I've been doing on my own. So far, I can select an image from my gallery and it sits in the photo placeholder, and then I press save, it says it was successful, but then I go to the profile page and there's no photo and when I go back to edit profile there's no photo there either. I looked at Firebase and saw that

Firestore android sdk cannot reach backend server on android 9 and other versions(android N also)

安稳与你 提交于 2020-08-10 20:20:08
问题 App is getting error firestore not able to reach backend, internet is working perfectly (can reach google.com), After searching for solutions I found that there is a option of firebase.firestore().settings({ experimentalForceLongPolling: true }); in firestore js sdk but not in android, Questions: Is this the right solution Whats the android equivalent https://github.com/firebase/firebase-js-sdk/issues/1674 It worked when I changed the network from wifi to cellular, can we achieve this through

Flutter firestore overwrites data when I use set data

主宰稳场 提交于 2020-08-10 20:15:51
问题 I have been trying to add data to sections in my firestorm database, I have a collection -> document -> data fields. Whenever I use setData({'key': 'value'}) is always overwrites the data already in the document. Is there anyway around this? 回答1: That is because what setData(object) is used for To create or overwrite a single document While update(object) To update some fields of a document without overwriting the entire document So what you need is to use update() 回答2: Using merge: true in

stream.listen((List<DocumentSnapshot> documentList) returns Instance of DocumentSnapshot.Flutter [Firebase]

被刻印的时光 ゝ 提交于 2020-08-10 20:13:47
问题 I just started learning Flutter and Dart. When I tried to query the locations of nearby documents as stated in this documentation.[To QUERY] https://pub.dev/packages/geoflutterfire , I got this printed in my console "Instance of 'DocumentSnapshot' " Here is my code. Future<void> GetusersLocation() async { Position position = await Geolocator() .getCurrentPosition(desiredAccuracy: LocationAccuracy.high); lat = position.latitude; long = position.longitude; } Future<dynamic> getnearbyusers(

How to convert a Map into arrayList from firestore document

假装没事ソ 提交于 2020-08-10 20:11:46
问题 My goal is to get query a collection and get the documents each document has three or five hashmap in it .my aim is to get the documents with different id's and populate in nested recycler view . But i facing trouble in converting the map values into arraylist My Main Model class: public class BattleGroupPosts { private String userId; public ArrayList<PostBattle> userPost; public BattleGroupPosts() { } ///below there getters and setters and constructions are there My PostBattle Modelclass:

Swiftui + Firebase - Not able to edit row

爷,独闯天下 提交于 2020-08-10 20:01:06
问题 Currently showing specific routines by authenticated users. I want to be able to edit routines. However, the current app is crashing when I try to edit. Any help would be appreciated! Please let me know if it would be helpful for me to add more information. My main View: struct custView: View { @ObservedObject var viewModel = RoutinesViewModel() var body: some View { List { ForEach(viewModel.routines, id: \.self) { routine in HStack { Text(routine.routine) NavigationLink(destination: Modify

How to get RemoteConfig defaultValue inside firebase function?

泪湿孤枕 提交于 2020-08-10 19:46:32
问题 I am writing a firebase function. And in there, I need a default value. And since I set up a Remote Config in Firebase, I try to use it inside my firebase function (to have one source of truth as for the default-values) Using the following code to retrieve a remoteConfig-parameter, how can you convert it to a typescript number ? const remoteConfigTemplate = await admin.remoteConfig().getTemplate(); const defaultVal = remoteConfigTemplate.parameters["video_max_duration"].defaultValue const

how to break querySnapshot on Firestore?

主宰稳场 提交于 2020-08-10 19:44:09
问题 I need to break querysnapshot loop. Is it possible? I tried with for loop. but the below error is coming. How to fix this error or Is there any way to break snapshot loop? code return query.get() .then((snapshot) => { for(const doc of snapshot) { let data = doc.data() if (data.age == 16) { break; } } error Type 'QuerySnapshot' must have a 'Symbol.iterator' method that returns an iterator. 回答1: You can use the docs property of the QuerySnapshot, which returns an array of all the documents in

Uploading multiple pdf files to Firebase storage - Android

半腔热情 提交于 2020-08-10 19:35:51
问题 I have an android app where user can upload multiple pdf files in a "folder". My app is working perfectly for uploading and viewing a single PDF file.To upload multiple files, I know I will have to use a for loop but I don't have any idea how to proceed. My code for uploading a single PDF is : StorageReference pdfRef = storageReference.child(fName + "/" + pdfName); pdfRef.putFile(pdfData) .addOnSuccessListener(new OnSuccessListener < UploadTask.TaskSnapshot > () { @Override public void

What's the best way to iterate through documents on a Firestore collection summing values?

主宰稳场 提交于 2020-08-10 19:25:09
问题 I'm trying to find out how to sum a value stored on every document inside a Firestore colletion, using the "cloud_firestore" package from Flutter. I tried this code: double queryValues() { total = 0.0; Firestore.instance .collection('myCollection') .snapshots() .listen((snapshot) { snapshot.documents.forEach((doc) => this.total += doc.data['amount']); }); debugPrint(this.total.toString()); return total; } But I end up printing 0.0 as result. If I remove the first line (total = 0.0.) I get the