Created
October 11, 2017 23:38
-
-
Save kenny-io/cbd2147b190f2fcfb2d96f1d33cc6371 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void addNewContact(){ | |
Map<String, Object>newContact = new HashMap<>(); | |
newContact.put(NAME_KEY, "John"); | |
newContact.put(EMAIL_KEY, "john@gmail.com"); | |
newContact.put(PHONE_KEY, "080-0808-009"); | |
db.collection("PhoneBook").document("Contacts").set(newContact) | |
.addOnSuccessListener(new OnSuccessListener<Void>() { | |
@Override | |
public void onSuccess(Void aVoid) { | |
Toast.makeText(MainActivity.this, "User Registered", | |
Toast.LENGTH_SHORT).show(); | |
} | |
}) | |
.addOnFailureListener(new OnFailureListener() { | |
@Override | |
public void onFailure(@NonNull Exception e) { | |
Toast.makeText(MainActivity.this, "ERROR" +e.toString(), | |
Toast.LENGTH_SHORT).show(); | |
Log.d("TAG", e.toString()); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment