contacts.create

연락처 개체를 반환합니다.

var contact = navigator.contacts.create(properties);

설명

contacts.create메서드는 동기적, 및 새로운 반환 합니다 Contact 개체.

이 메서드를 호출 해야 장치 연락처 데이터베이스에 연락처 개체를 유지 하지 않습니다는 Contact.save 방법.

지원 되는 플랫폼

  • 안 드 로이드
  • 블랙베리 WebWorks (운영 체제 5.0와 더 높은)
  • iOS
  • Windows Phone 7과 8

빠른 예제

var myContact = navigator.contacts.create({"displayName": "Test User"});

전체 예제

<!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>