firebase-realtime-database

angular/firebase format retrieved data from firebase into array

心已入冬 提交于 2020-05-17 06:11:26
问题 hello guys i have a problem to format my firebase-data into array this is my service where im retrieving data from firebase filename: subcategory.service.ts export class SubcategoryService { subcategoryRef: AngularFireList<any> = null; constructor(private db: AngularFireDatabase) { this.subcategoryRef = db.list("/subCategory"); } getSubCategoriesById(inp_subCatid: string): Observable<any[]> { return this.subcategoryRef.snapshotChanges().pipe( take(1), map(changes => changes.map(c => ({ key: c

How to check if usernames are unique in Firebase

旧时模样 提交于 2020-05-16 04:34:44
问题 I have a function (not finished yet) that should check if a username already exists/is unique in my Firebase database. I have searched Google on how to implement this and I have managed to get the below. Unfortunately, it doesn't work and I don't even get any console.logs. Any help is appreciated - what exactly am I doing wrong? onChangeUsername = (event) => { var oldError = {...this.state.error}; firebase.database().ref().child("Usernames").orderByValue().once('value', (snapshot) => { var

How to logout user from firebase database?

六眼飞鱼酱① 提交于 2020-05-16 03:32:33
问题 I'm using firebase database using firebaseUser authorisation. I successfully logout user from app, but when I logout user the app is crashed due to firebase database reference. I got logcat message showing that This client does not have permission to perform this operation. How can I logout user from firebase database? 回答1: You don't logout from the "database" as such, but logout from Firebase with FirebaseAuth.getInstance().signOut() . After that, the user can't access parts of the database

Child Event Listener Keep adding itself in recyclerView

北城以北 提交于 2020-05-16 03:15:32
问题 I am trying to show messages between two users in a recyclerview . Everything goes alright until i restart the activity in either device of the both when i restart the activity a child event listener is added and i see multiple message in place of one that i sent and when i restart my activity without sending any message it shows me original number of messages and if i send or recieve a message again i see multiple messages and the cycle repeats.I have tried removing listener in onDestroy and

React CORS issue with firebase even though rule is set to true

守給你的承諾、 提交于 2020-05-15 21:35:25
问题 I am 99% sure that i set the rules correctly for my firebase realtime database. React-Redux is used for by both react app that call the firebase However the problem is quite puzzling, 1) I created a new react app and try to do an axios POST/GET to the firebase but CORS error keep happening 2) I used my old react app and call the same API as (1) no CORS error and the POST request went through. 3) I test that the API works using postman, both POST and GET request went through 4) I also verified

Get parent name using child key in firebase android

不羁岁月 提交于 2020-05-15 12:18:43
问题 I am trying to get parent name "170002001" by using child key "UID" in android studio. Please help. Thanks in advance :) String uid = user.getUid(); private void getdata(){ DatabaseReference reference; reference = FirebaseDatabase.getInstance().getReference(); reference.orderByChild("UID").equalTo(uid).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) {

Get parent name using child key in firebase android

最后都变了- 提交于 2020-05-15 12:17:40
问题 I am trying to get parent name "170002001" by using child key "UID" in android studio. Please help. Thanks in advance :) String uid = user.getUid(); private void getdata(){ DatabaseReference reference; reference = FirebaseDatabase.getInstance().getReference(); reference.orderByChild("UID").equalTo(uid).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) {

Firebase Database: Getting “No-Argument Constructor” Error Despite Having It

北城余情 提交于 2020-05-15 11:26:13
问题 I am trying to writing data in an activity and then reading it in another activity. My writing part is working. For my reading part, I am trying to use getValue with parameter of a class I wrote. But I keep getting this error: com.google.firebase.database.DatabaseException: Class ozhan.climb.MainActivity$User does not define a no-argument constructor. If you are using ProGuard, make sure these constructors are not stripped. My class that used in getValue() : class User { public String Server,

How to show if a message is seen or not via using Firebase Real time Database

六眼飞鱼酱① 提交于 2020-05-15 09:30:10
问题 I want to show if a message is seen or not in my app which is using Firebase Real time Database.What i am able to till now is update it on on the database if the message is seen or not but i am not able to retrieve that value using listeners in my recyclerview Adaptor .It happens that if the last message is not seen it displays all the previous messages are not seen similarly if the last message is seen it displays all the previous messages are seen. Database Structure My Code for checking if

How to get documents in firestore, whose document IDs are stored in the list?, i.e bring only those documents…?

99封情书 提交于 2020-05-15 07:52:09
问题 I have a list that contains the document Ids of a particular collection "users", and I want to get documents only present in this list, and these documents are in "users" collection as mention before. Code: getUsers() async { double radius = 0.3; String field = "GeoPosition"; print(currentUser.point.longitude); GeoFirePoint center = geo.point(latitude: currentUser.point.latitude, longitude: currentUser.point.longitude); var collectionRef = Firestore.instance.collection('user_locations')