Open default phone Contacts app with Expo

57 views Asked by At

I'm using React Native Expo, and I want to open the default phone Contacts app.

On Android, I used:

await Linking.openURL("content://contacts/people/");

and that's worked.

On iOS that doesn't work.

I tried:

await Linking.openURL('contacts://');

but it doesn't work. How do I do that on IOS?

I want to open the contacts app on the iPhone only. Not getting contact data from the device through my app as suggested in some answers.

1

There are 1 answers

8
Mahammad Momin On

To open the default dialer app on iOS without a number pre-filled, you can try using the telprompt://{your number} URL scheme, which should prompt the dialer to open without immediately initiating a call. Here’s how you might use it in React Native

 import { Linking } from 'react-native';

// Function to open the dialer
const openDialer = async () => {
  const url = 'telprompt://<<your Number>>';
  const supported = await Linking.canOpenURL(url);

  if (supported) {
    await Linking.openURL(url);
  } else {
    console.log('Unable to open dialer');
  }
};