We have answer of your question!

100% solved queries, no empty question

0

Advertisement


I am new to the firebase. I tried to save the properties of the users listed in my application into the database Firebase, this is code

mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            firebaseuser = firebaseAuth.getCurrentUser();
            if (firebaseuser != null) {
                finish();
                firebaseuser = mAuth.getCurrentUser();
                String nama = firebaseuser.getDisplayName();
                String mail = firebaseuser.getEmail();
                //String pass = password.getText().toString();
                String id = firebaseuser.getUid();
                //Uri gambar = firebaseuser.getPhotoUrl();
                member1 = new Member(nama, mail, "", "belum", "belum", "belum", id);
                datab.getReference("member").push().setValue(member1);
                startActivity(new Intent(getApplicationContext(), HalamanUtama.class));
            }
        }
    };

the problem here is when I get into my application using the Google sign in, I can not save the information of the user who signed in to my application with google to my firebase database, but I can save the user's login information using email method. This is the code to get into my application using email

mAuth.createUserWithEmailAndPassword(email.getText().toString(), password.getText().toString())
                        .addOnCompleteListener(HalamanPendaftaran.this, new OnCompleteListener<AuthResult>() {
                            @Override
                            public void onComplete(@NonNull Task<AuthResult> task) {
                                if (task.isSuccessful()) {
                                    progressdialog.dismiss();
                                    finish();
                                    firebaseuser = mAuth.getCurrentUser();
                                    String nama = firebaseuser.getDisplayName();
                                    String mail = firebaseuser.getEmail();
                                    String pass = password.getText().toString();
                                    String id = firebaseuser.getUid();
                                    Uri gambar = firebaseuser.getPhotoUrl();
                                    member1 = new Member(nama, mail, pass, "belum", "belum", "belum", id, gambar);
                                    datab.getReference("member").push().setValue(member1);
                                    startActivity(new Intent(HalamanPendaftaran.this, HalamanUtama.class));
                                } else {
                                    progressdialog.dismiss();
                                    Toast.makeText(HalamanPendaftaran.this, "tidak dapat mendaftarkan user, tolong coba lagi !", Toast.LENGTH_SHORT).show();
                                    email.setText("");
                                    password.setText("");
                                }
                            }
                        });

As for the error I get when trying to store user data that sign in using google

01-10 18:42:00.619 8218-8218/com.example.asus.fastapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.asus.fastapp, PID: 8218
java.lang.StackOverflowError: stack size 8MB
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE(Unknown Source)
at com.google.android.gms.internal.zzbqi$zza.zzaF(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzax(Unknown Source)
at com.google.android.gms.internal.zzbqi.zzaE

This is one of the data of the user who successfully saved Firebase Database data

any help would be greatly appreciated

Question author Wildan-iskandar | Source

Answer


1


Advertisement


Your Member class contains a field of type Uri. Uri is not one of the native types that Firebase serializes.

Change your Member class to store the Uri as a String and use Uri.toString() and Uri.parse() to convert.

Answer author Qbix

Advertisement


Tickanswer.com is providing the only single recommended solution of the question error "java.lang.StackOverflowError:" when try to save object in Firebase Database under the categories i.e java , android , firebase , firebase-database , firebase-authentication , . Our team of experts filter the best solution for you.

Related Search Queries:

You may also add your answer!