我调用了以下方法,但是我看不到任何回叫。
Log.d(TAG,"adding to firebase");
// Create a new user with a first and last name
Map<String, Object> user = new HashMap<>();
user.put("first", "rambo");
user.put("last", "Lovelace");
user.put("born", 1815);
db.collection("aks")
.add(user)
.addOnSuccessListener(new OnSuccessListener<DocumentReference>() {
@Override
public void onSuccess(DocumentReference documentReference) {
Log.d(FIRE_TAG, "akshay:DocumentSnapshot added with ID: " + documentReference.getId());
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d(FIRE_TAG, "akshay:Error adding document", e);
}
})
.addOnCanceledListener(new OnCanceledListener() {
@Override
public void onCanceled() {
Log.w(FIRE_TAG,"akshayoncancel listner");
}
})
.addOnCompleteListener(new OnCompleteListener<DocumentReference>() {
@Override
public void onComplete(@NonNull Task<DocumentReference> task) {
Log.w(FIRE_TAG,"on completed listner");
}
});
Log.d(TAG,“ done”);
我看到控制台上印有“添加到firebase”和“完成”,但是没有调用成功/失败回调。为什么这样?