contact


find

검색어를 이용하여 검색 대상 Array필드에서 해당 주소록 목록 배열을 받아온다.

options

필드설명M/O
fields

검색 대상 Array 필드명들

  • phoneNumbers
  • displayName
  • email
O
filter검색어O
   

successCallback

필드필드필드필드설명
result   options에 해당되는 주소록 목록 배열
id  검색된 개별 주소록의 Primary Key 값
displayName  검색된 이름 
email  검색된 이메일 목록 배열
phoneNumbers[key][value]검색된 전화번호 목록 배열
각 목록은 전화번호의 Type과 Value로 구성
     

errorCallback

필드설명
code에러코드
message에러메세지
  

Example

var fields = 'phoneNumbers, displayName, email';
var filter = 'filter name';
hone.channel.execute('contact', 'find',
    [fields, filter],
   function (result) {
       // success callback
       console.log(JSON.stringify(result));
       var firstName = result[0].displayName;
    },
   function (e) {
       // error callback
       alert(JSON.stringify(e));
    }
);

Result

[{
   "displayName": "한서연",
   "email": [],
   "id": "77",
   "phoneNumbers": [{
       "mobile": "01012341234"
    }]
}, {
   "displayName": "이한종",
   "email": [],
   "id": "396",
   "phoneNumbers": [{
       "other": "01012351235"
    }]
}, {
   "displayName": "한선기",
   "email": [],
   "id": "407",
   "phoneNumbers": [{
       "other": "01012361236"
    }]
}]

add

firstName(필수), lastName(필수), email, mobile, work, home을 단말의 주소록에 추가한다.

options

필드설명M/O
firstNameM
lastName이름M
email이메일주소
mobile핸드폰O
work회사 전화번호O
home집 전화번호
   

successCallback 

필드 설명
없음없음
  

errorCallback

필드설명
code에러코드
message에러메세지
  

Example

var contact = {
    firstName : "길동", // 필수
   lastName : "홍", // 필수
   email : "멋쟁이",
    mobile : "010-1234-3456",
    work : "02-3333-4444",
    home : "02-5555-6666" // v2.6 이상부터 지원 파라미터
};

hone.channel.execute('contact', 'add',
    [contact],
   function () {
       // success callback
   },
   function (e) {
       // error callback
       alert(JSON.stringify(e));
    }
);

remove

특정 주소록을 삭제한다. 

options

필드설명M/O
idid 값은 find 로 얻은 개별 주소록에 Primary Key 값 이다.M
   

successCallback

필드설명
없음없음
  

errorCallback

필드설명
code에러코드
message에러메세지
   

Example

var id = 1; // find 등으로 얻은 contact 의 id 값
hone.channel.execute('contact', 'remove',
    [id],
   function () {
       // success callback
   },
   function (e) {
       // error callback
       alert(JSON.stringify(e));
    }
);

Error Code

CodeCauseComment
E10200파라메터 값이 잘못되어 있을 경우 
E10201전달된 액션 값이 알 수 없는 액션일 경우 
E10202주소록 정보 추가시 성이 잘못되어 있을 경우 
E10203주소록 정보 추가시 이름이 잘못되어 있을 경우 
E10204주소록 삭제시 개별 주소록에 Primary Key 값이 잘못되어 있을 경우 
E10250실행 중 오류가 발생 되었을 경우 
E10299알 수 없는 오류가 발생 되었을 경우