Device.getContacts
Functional API
fetchContactsYou can use the same feature with it as well.
Feature description
Fetch the user's contact list page by page. size·offsetpaginate with query.containsto search by name containing text. offsetis on the first call 0, and afterward use the response's nextOffsetUse it.
If there is no permission to read contacts FetchContactsPermissionErroroccurs. Device.getContacts.getPermission() / Device.getContacts.openPermissionDialog()you can check/request permission with
Type
Device.getContacts(options: FetchContactsOptions): Promise<ContactResult>;Params
type FetchContactsOptions = {
size: number;
offset: number;
query?: {
contains?: string;
};
};Response
type ContactEntity = {
name: string;
phoneNumber: string;
};
type ContactResult = {
result: ContactEntity[];
nextOffset: number | null;
done: boolean;
};Error
The error is thrown as a class — error instanceof FetchContactsPermissionErroridentify it with. The class can @apps-in-toss/web-frameworkbe imported from
FetchContactsPermissionError
This occurs when permission to read contacts is denied. Device.getContacts.openPermissionDialog()You can request again with
Example code
Was this helpful?