wumke / react-native-immediate-phone-call

Initiate immediate phone call (without further user interaction) for React Native on iOS and Android.
GNU General Public License v3.0
174 stars 51 forks source link
react-native

react-native-immediate-phone-call

Initiate immediate phone call (without further user interaction) for React Native on iOS and Android.

The difference with react-native-phone-call and react-native-communications is that with this library no additional user input is required for Android and the call starts instantly (Apple always asks confirmation since the last iOs updates...).

NOTICE:

Setup

(NOTICE THAT INSTALLATION STEPS FOR NEWER REACT NATIVE VERSIONS MAY BE DIFFERENT...)

For expo managed projects skip to expo setup guide

Fast and easy:

npm install react-native-immediate-phone-call --save

Add to your project automatically

react-native link react-native-immediate-phone-call

Or manual: add the latest version as dependency to your package.json.

{
  "name": "YourProject",
  ...
  },
  "dependencies": {
    ...
    "react-native-immediate-phone-call": "^1.0.0",
    ...
  }

iOS

  <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>tel</string>
        <string>telprompt</string>
    </array>

Android

Setup in Expo

Install package

npm install react-native-immediate-phone-call --save

In the app.json file of your expo project add:

...
       "permissions": [
        ...
        "android.permission.CALL_PHONE"   // <--- add to your project permissions
      ],
...

Note: React-native-immediate-phone-call won't work in expo go and expo dev-client app, you'll need to build an actual apk to test it.

Usage

import RNImmediatePhoneCall from 'react-native-immediate-phone-call';
...
RNImmediatePhoneCall.immediatePhoneCall('0123456789');
...

Versioning

This project uses semantic versioning: MAJOR.MINOR.PATCH. This means that releases within the same MAJOR version are always backwards compatible. For more info see semver.org.