연락처 (Contacts)
Contacts 모듈은 기기에 저장된 연락처 정보를 가져오는 기능을 제공합니다.
메서드
checkPermission
연락처 접근 권한 상태를 확인합니다.
checkPermission(): Promise<boolean>
getContacts
연락처 목록을 가져옵니다.
getContacts(): Promise<Contact[]>
- Contact 타입:
recordId: 고유 식별자givenName: 이름familyName: 성phoneNumbers: 전화번호 목록 ({ label, number }[])emailAddresses: 이메일 주소 목록 ({ label, email }[])
사용 예제
import { appify } from '@nolraunsoft/appify-sdk';
async function fetchContacts() {
const isAllowed = await appify.contacts.checkPermission();
if (isAllowed) {
const contacts = await appify.contacts.getContacts();
console.log(`${contacts.length}개의 연락처를 찾았습니다.`);
if (contacts.length > 0) {
const first = contacts[0];
console.log(`이름: ${first.familyName}${first.givenName}`);
}
}
}