Zum Hauptinhalt springen
@capgo/capacitor-contacts Device-APIs Open Source

Kontakte Capacitor Plugin

Auf Gerätekontakte zugreifen und sie mit Lese- und Schreibzugriff verwalten

Installieren

bun add @capgo/capacitor-contacts bunx cap sync
npm, pnpm oder yarn
  • npm install @capgo/capacitor-contacts
  • pnpm add @capgo/capacitor-contacts
  • yarn add @capgo/capacitor-contacts

Anleitung

So verwendest du Contacts in Capacitor

Nutzung von @capgo/capacitor-contacts

Capacitor Contacts Plugin zur Verwaltung der Geräte-Kontakte.

Installieren

bun add @capgo/capacitor-contacts
bunx cap sync

bunx cap sync kopiert den nativen code des Plugins in deine nativen Projekte. Nach jedem Plugin-Upgrade erneut ausführen.

Importieren

import { CapacitorContacts } from '@capgo/capacitor-contacts';

API auf einen Blick

Methode Beschreibung
countContacts Zähle die Gesamtzahl der Kontakte auf dem Gerät.
createContact Erstelle einen neuen Kontakt programmatisch.
createGroup Erstelle eine neue Kontaktgruppe.
deleteContactById Lösche einen Kontakt per ID.
deleteGroupById Lösche eine Gruppe per ID.
displayContactById Zeige einen Kontakt im nativen Kontakt-Viewer an.
displayCreateContact Zeigt die native UI zum Erstellen von Kontakten an.
displayUpdateContactById Zeigt die native UI zum Aktualisieren eines bestimmten Kontakts an.
getAccounts Ruft alle auf dem Gerät verfügbaren Accounts ab.
getContactById Ruft einen bestimmten Kontakt anhand der ID ab.
getContacts Ruft alle Kontakte vom Gerät ab.
getGroupById Ruft eine bestimmte Gruppe anhand der ID ab.
getGroups Ruft alle Kontaktgruppen ab.
isAvailable Prüft, ob Kontakte auf dem Gerät verfügbar sind.
isSupported Prüft, ob das Plugin auf der aktuellen Plattform unterstützt wird.
openSettings Öffnet die Kontakteinstellungen des Geräts.
pickContact Wählt einen einzelnen Kontakt über den nativen Kontakt-Auswahl-Assistenten aus.
pickContacts Wählt einen oder mehrere Kontakte über den nativen Kontakt-Auswahl-Assistenten aus.
updateContactById Bestehenden Kontakt anhand der ID aktualisieren.
checkPermissions Prüfe den aktuellen Berechtigungsstatus für Kontakte.
requestPermissions Berechtigungen für den Zugriff auf Kontakte anfordern.

Beispiele

countContacts()

Zähle die Gesamtzahl der Kontakte auf dem Gerät.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

const result = await CapacitorContacts.countContacts();
console.log(result);

createContact()

Erstelle einen neuen Kontakt programmatisch.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

const result = await CapacitorContacts.createContact({ contact: {} });
console.log(result);

createGroup()

Erstelle eine neue Kontaktgruppe.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

const result = await CapacitorContacts.createGroup({ group: { name: 'example' } });
console.log(result);

deleteContactById()

Lösche einen Kontakt per ID.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

await CapacitorContacts.deleteContactById({ id: 'id-123' });

deleteGroupById()

Lösche eine Gruppe per ID.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

await CapacitorContacts.deleteGroupById({ id: 'id-123' });

displayContactById()

Zeige einen Kontakt im nativen Kontakt-Viewer an.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

await CapacitorContacts.displayContactById({ id: 'id-123' });

Die obige Tabelle listet die 21 Kernmethoden auf. Listener- und Versions-Helper sowie der vollständige Contract jeder Methode sind dokumentiert in GitHub Repository.

Vollständige Referenz

Weiter mit der Nutzung von @capgo/capacitor-contacts

Wenn du es nutzt Nutzung von @capgo/capacitor-contacts um Dashboard- und API-Operationen zu planen, verbinde es mit @capgo/capacitor-contacts für die Implementierungsdetails in @capgo/capacitor-contacts, Erste Schritte für die Implementierungsdetails in Erste Schritte, API Übersicht für Details zur Implementierung im API Overview, Einführung für die Implementierungsdetails in der Einleitung und API Schlüssel für die Implementierungsdetails in den API Keys.

FAQ

Contacts Plugin FAQ

Wie installiere ich das Contacts Plugin in einer Capacitor-App?

Führe "bun add @capgo/capacitor-contacts" (oder "npm install @capgo/capacitor-contacts") aus und danach "bunx cap sync", damit die iOS- und Android-Projekte das native code übernehmen. Importiere es in deiner App code aus "@capgo/capacitor-contacts".

Funktioniert @capgo/capacitor-contacts mit React, Vue und Angular?

Ja. Contacts ist ein Capacitor-Package und funktioniert daher mit jedem Web-Framework, das in Capacitor läuft, einschließlich Ionic, React, Vue, Angular, Svelte und reinem JavaScript.

Welche Capacitor-Version unterstützt @capgo/capacitor-contacts?

Capgo Plugins folgen der Major-Version von Capacitor: Nutze die Plugin-Major-Version, die zu deiner Capacitor Major-Version passt (z. B. Plugin v8 bei Capacitor 8). Die Kompatibilitätstabelle im GitHub README listet die gepflegten Versionen auf.

Ist @capgo/capacitor-contacts kostenlos und Open Source?

Ja. Der Source-code ist öffentlich auf GitHub unter https://github.com/Cap-go/capacitor-contacts/ einsehbar und das Package lässt sich kostenlos über npm installieren. Bug-Reports und Pull Requests sind willkommen.

Kann ich code, das Contacts nutzt, ohne App-Store-Review aktualisieren?

Die Installation oder ein Upgrade des Plugins ändert den nativen code, weshalb ein neuer Store-Build nötig ist. Danach können JavaScript-, HTML- und CSS-Änderungen, die das Plugin aufrufen, sofort per Capgo Live Updates ausgeliefert werden.

Contacts-Änderungen ausrollen, ohne auf das App-Review zu warten

Sobald das Plugin in deinem Store-Build ist, bringt Capgo mit Live-Updates deine JavaScript-, HTML- und CSS-Änderungen in Minuten zu den Nutzern.

Starte mit Capgo