Questa non è la versione più recente della documentazione!
Click here for the latest released version.
Contacts.Create
Restituisce un nuovo oggetto di contatto.
var contact = navigator.contacts.create(properties);
Descrizione
Il contacts.create
metodo sincrono e restituisce un nuovo Contact
oggetto.
Questo metodo non mantiene l'oggetto contatto nel database contatti dispositivo, per cui è necessario richiamare il Contact.save
metodo.
Piattaforme supportate
- Android
- BlackBerry WebWorks (OS 5.0 e superiori)
- iOS
- Windows Phone 7 e 8
Esempio rapido
var myContact = navigator.contacts.create({"displayName": "Test User"});
Esempio completo
<!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>