Home > Software design >  None of the callback of Firestore.collection.document.set() is trigering
None of the callback of Firestore.collection.document.set() is trigering

Time:03-31

I am working on a project that uses firestore but it is not setting the value of the document. Authentication is working fine but the Firestore.collection.document.set() is not working. here is the code I have tried

collectionReference.document(email).set(data).addOnSuccessListener(new OnSuccessListener<Void>() {
    @Override
    public void onSuccess(Void unused) {
        auth.signOut();
        progressDialog.dismiss();
        startActivity(new Intent(SignUpRepActivity.this,LoginActivity.class));
    }
}).addOnFailureListener(new OnFailureListener() {
    @Override
    public void onFailure(@NonNull Exception e) {
        e.printStackTrace();
    }
}).addOnCanceledListener(new OnCanceledListener() {
    @Override
    public void onCanceled() {
        Log.v("Cancelled","Cancelled");
    }
}).addOnCompleteListener(new OnCompleteListener<Void>() {
    @Override
    public void onComplete(@NonNull Task<Void> task) {
        Log.v("Task","Complete");
    }
});

None of these callbacks are working and nothing in logs as well.

CodePudding user response:

auth.signout() deletes the current registration token, clears the document folder on the device, and logs out the user. As confirmed by @Junaid Khalid, by removing the auth.signout(), it is working fine now.

  • Related