I\'m trying to extract the auto-generated Id under a document so I can use it elsewhere.
Here is the full code:
mStartChatButton.setOnClickListener(new V
For part one, you'll want to get the document reference in the onSuccess function vs. void. So that would look something like this -
mWhammyUsersCollection.document(mCurrentUserId).collection("my-chats").add(myChatFields)
.addOnSuccessListener(new OnSuccessListener() {
@Override
public void onSuccess(DocumentReference documentReference) {
String chatId = documentReference.getId();
Log.v("CHATS", chatId);
myChatFields.put("chatCardId", chatId);
Intent goToChatActivity = new Intent(UserProfileActivity.this,
ChatActivity.class);
startActivity(goToChatActivity);
}
});