petervelosy / capacitor-contact-picker

Capacitor plugin for using the native contact picker UI to select contacts from your device.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@teamhive/capacitor-contact-picker

This package allows you to use the native contact picker UI on Android or iOS for receiving contact information. iOS supports selecting multiple contacts. Android only support single selection. Both platforms will return the same payload structure, where the data exists.

Installation

yarn add @teamhive/capacitor-contact-picker
// or
npm i @teamhive/capacitor-contact-picker

Android

Register the plugin class in your MainActivity.java:

import com.teamhive.capacitor.ContactPicker;

public class MainActivity extends BridgeActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        ...
        add(ContactPicker.class);
    }
}

Usage

import { Plugins } from '@capacitor/core';

const { ContactPicker } = Plugins;

async openPicker() {
    const res = await ContactPicker.open();
    // res.value is an array of contacts
}

About

Capacitor plugin for using the native contact picker UI to select contacts from your device.


Languages

Language:Java 71.6%Language:Swift 14.9%Language:TypeScript 5.1%Language:Ruby 4.1%Language:Objective-C 3.2%Language:JavaScript 1.1%