Dies ist nicht die neueste Version der Dokumentation!
Click here for the latest released version.
Contacts.Create
Gibt ein neues Kontaktobjekt zurück.
var contact = navigator.contacts.create(properties);
Beschreibung
Die contacts.create
Methode ist synchron und gibt eine neue Contact
Objekt.
Diese Methode behält nicht das Contact-Objekt in der Gerät-Kontakte-Datenbank, für die müssen Sie Aufrufen der Contact.save
Methode.
Unterstützte Plattformen
- Android
- BlackBerry WebWorks (OS 5.0 und höher)
- iOS
- Windows Phone 7 und 8
Kleines Beispiel
var myContact = navigator.contacts.create({"displayName": "Test User"});
Vollständiges Beispiel
<!DOCTYPE html>
<html>
<head>
<title>Contact Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady() {
var myContact = navigator.contacts.create({"displayName": "Test User"});
myContact.note = "This contact has a note.";
console.log("The contact, " + myContact.displayName + ", note: " + myContact.note);
}
</script>
</head>
<body>
<h1>Example</h1>
<p>Create Contact</p>
</body>
</html>