Skip to main content
Glama
contacts.md2.95 kB
--- title: Contacts description: A library that provides access to the phone's system contacts. sourceCodeUrl: https://github.com/expo/expo/tree/main/packages/expo-contacts packageName: expo-contacts iconUrl: /static/images/packages/expo-contacts.png platforms: ["android", "ios"] --- import { ConfigReactNative, ConfigPluginExample, ConfigPluginProperties, } from '~/ui/components/ConfigSection'; `expo-contacts` provides access to the device's system contacts, allowing you to get contact information as well as adding, editing, or removing contacts. On iOS, contacts have a multi-layered grouping system that you can also access through this API. ## Installation ## Configuration in app config You can configure `expo-contacts` using its built-in [config plugin](/config-plugins/introduction/) if you use config plugins in your project ([EAS Build](/build/introduction) or `npx expo run:[android|ios]`). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. ```json app.json { "expo": { "plugins": [ [ "expo-contacts", { "contactsPermission": "Allow $(PRODUCT_NAME) to access your contacts." } ] ] } } ``` If you're not using Continuous Native Generation ([CNG](/workflow/continuous-native-generation/)) (you're using native **android** and **ios** projects manually), then you need to configure following permissions in your native projects: - For Android, add `android.permission.READ_CONTACTS` and `android.permission.WRITE_CONTACTS` permissions to your project's **android/app/src/main/AndroidManifest.xml**: ```xml <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> ``` - For iOS, add the `NSContactsUsageDescription` key to your project's **ios/[app]/Info.plist**: ```xml <key>NSContactsUsageDescription</key> <string>Allow $(PRODUCT_NAME) to access your contacts</string> ``` ## Usage ```jsx useEffect(() => { (async () => { const { status } = await Contacts.requestPermissionsAsync(); if (status === 'granted') { const { data } = await Contacts.getContactsAsync({ fields: [Contacts.Fields.Emails], }); if (data.length > 0) { const contact = data[0]; console.log(contact); } } })(); }, []); return ( <View style={styles.container}> <Text>Contacts Module Example</Text> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, }); ``` ## API ```js ``` ## Permissions ### Android This library automatically adds `READ_CONTACTS` and `WRITE_CONTACTS` permissions to your app: ### iOS The following usage description keys are used by this library:

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jaksm/expo-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server