1.1.1 • Published 4 years ago

react-native-makephonecall v1.1.1

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

react-native-makephonecall

Introduction

This is a small module that allows you to initiate a phone call in React Native. Support Android X.

NOTE

No additional user input is required for Android and the call starts instantly (Apple always asks confirmation since the last iOS updates). This will work on a actual device. The iOS simulator does not support phone call feature.

Getting started

$ npm install react-native-makephonecall --save

Mostly automatic installation

$ react-native link react-native-makephonecall

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-make-phone-call and add RNMakePhoneCall.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNMakePhoneCall.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.repartamos.makephonecall; to the imports at the top of the file
  • Add new RNMakePhoneCallPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-makephonecall'
    project(':react-native-makephonecall').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-makephonecall/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-makephonecall')

Usage

import Phone from 'react-native-makephonecall';

Phone.makeCall("88855443322");

Permissions Methods (optional)

checkPermission (callback) - checks permission to access phone call.
requestPermission (callback) - request permission to access phone call.

Usage as follows:

Phone.checkPermission((err, permission) => {
  if (err) throw err;

  // Phone.PERMISSION_AUTHORIZED || Phone.PERMISSION_UNDEFINED || Phone.PERMISSION_DENIED
  if (permission === 'undefined') {

  }
  if (permission === 'authorized') {
    // yay!
  }
  if (permission === 'denied') {
    // x.x
    Phone.requestPermission((error, requestPermission) => {
      // ...
    })
  }
})

These methods are only useful on Android.

1.1.1

4 years ago

1.1.0

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.6

5 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago