패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.6.3

contacts_service

Android 및 iOS 장치에서 연락처를 검색하고 관리하기 위한 플러터 플러그인입니다.

AndroidiOS
30일 다운로드
2.9천
좋아요
599
Pub 점수
140

패키지 설치

flutter pub add contacts_service

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

contacts_service 패키지는 Android 및 iOS 플랫폼에서 장치 연락처에 액세스하고 관리할 수 있도록 해주는 Flutter 플러그인입니다. 연락처 목록을 가져오고 이름, 전화번호, 이메일과 같은 연락처 세부 정보를 읽으며 필터링 및 검색과 같은 기본 작업을 지원하는 일관된 API를 제공합니다. 크로스플랫폼 호환성을 위해 설계되어 플랫폼별 코드 없이 네이티브 연락처 시스템과 통합할 수 있도록 간소화합니다. 연락처 조회 또는 가져오기 기능이 필요한 앱에 적합합니다.

사용 사례

  • 연락처 목록 검색
  • 연락처 검색 및 필터링
  • 앱으로 연락처 가져오기
  • 앱 데이터와 연락처 동기화
  • UI에서 연락처 세부 정보 표시

주요 기능

  • 크로스 플랫폼 지원 (Android 및 iOS)
  • 연락처 접근을 위한 간단한 API
  • 이름, 전화번호, 이메일과 같은 연락처 필드를 지원합니다
  • 검색 및 필터링 기능
  • 네이티브 코드가 필요하지 않습니다

적합한 대상

  • 연락처 접근이 필요한 앱
  • 사용자 프로필 가져오기 도구
  • 통신 앱
  • CRM 통합
  • 연락처 선택기 위젯

고려 사항

  • Android 및 iOS에서 런타임 권한이 필요합니다
  • 기본 연락처 작업에 한정
  • 개인정보 보호 준수 필요
  • 접근을 위해 사용자 동의가 필요할 수 있습니다
  • 성능은 장치 연락처 데이터베이스 크기에 따라 달라집니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

contacts_service

pub package Build Status Coverage Status

A Flutter plugin to access and manage the device's contacts.

Usage

To use this plugin, add contacts_service as a dependency in your pubspec.yaml file.
For example:

dependencies:  
    contacts_service: ^0.6.3

Permissions

Android

Add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_CONTACTS" />  
<uses-permission android:name="android.permission.WRITE_CONTACTS" />  
iOS

Set the NSContactsUsageDescription in your Info.plist file

<key>NSContactsUsageDescription</key>  
<string>This app requires contacts access to function properly.</string>  

Note
contacts_service does not handle the process of asking and checking for permissions. To check and request user permission to access contacts, try using the following plugins: flutter_simple_permissions or permission_handler.

If you do not request user permission or have it granted, the application will fail. For testing purposes, you can manually set the permissions for your test app in Settings for your app on the device that you are using. For Android, go to "Settings" - "Apps" - select your test app - "Permissions" - then turn "on" the slider for contacts.

Example

// Import package  
import 'package:contacts_service/contacts_service.dart';  
  
// Get all contacts on device
List<Contact> contacts = await ContactsService.getContacts();  

// Get all contacts without thumbnail (faster)
List<Contact> contacts = await ContactsService.getContacts(withThumbnails: false);

// Android only: Get thumbnail for an avatar afterwards (only necessary if `withThumbnails: false` is used)
Uint8List avatar = await ContactsService.getAvatar(contact);
  
// Get contacts matching a string
List<Contact> johns = await ContactsService.getContacts(query : "john");

// Add a contact  
// The contact must have a firstName / lastName to be successfully added  
await ContactsService.addContact(newContact);  
  
// Delete a contact
// The contact must have a valid identifier
await ContactsService.deleteContact(contact);  

// Update a contact
// The contact must have a valid identifier
await ContactsService.updateContact(contact);

// Usage of the native device form for creating a Contact
// Throws a error if the Form could not be open or the Operation is canceled by the User
await ContactsService.openContactForm();

// Usage of the native device form for editing a Contact
// The contact must have a valid identifier
// Throws a error if the Form could not be open or the Operation is canceled by the User
await ContactsService.openExistingContact(contact);

Contact Model

// Name
String displayName, givenName, middleName, prefix, suffix, familyName;

// Company
String company, jobTitle;

// Email addresses
List<Item> emails = [];

// Phone numbers
List<Item> phones = [];

// Post addresses
List<PostalAddress> postalAddresses = [];

// Contact avatar/thumbnail
Uint8List avatar;

Example

Contributions

Contributions are welcome! If you find a bug or want a feature, please fill an issue.

If you want to contribute code please create a pull request under the staging branch.

Credits

Heavily inspired from rt2zz's react native plugin

카테고리

의존성

의존성 목록 2 개

소스 저장소

이 패키지를 사용하는 프로젝트