react-native-voip-push-receiver

1.0.3 • Public • Published

React Native Android Voip Push Receiver

npm version

This package is for handling incoming voip push notifications on Android (for iOS, you can use this).

Prerequisites

This package listens for FCM messages dispatched by your sip server when an incoming call is about to be routed. It is assumed that you already have notification handling configured for firebase in your react-native app. If you haven't yet, then start here.

Getting started

$ npm install react-native-voip-push-receiver --save

Mostly automatic installation

$ react-native link react-native-voip-push-receiver

Manual installation

Android

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

In AndroidManifest.xml

...
<service
  android:name="com.ReactNativeVoipPushReceiver.RNVoipPushReceiverHandler"
  android:exported="false">
  <intent-filter>
      <action android:name="com.google.firebase.MESSAGING_EVENT" />
  </intent-filter>
</service>
...
 

Usage

import { AndroidVoipPushReceiver } from 'react-native-voip-push-receiver';
 
...
 
AndroidVoipPushReceiver.setNotificationReceivedListener(() => {
  // Force your sip device to register when notification is received
  this.handleRegisterSipDevice();
});
 

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i react-native-voip-push-receiver

    Weekly Downloads

    3

    Version

    1.0.3

    License

    none

    Unpacked Size

    12.1 kB

    Total Files

    11

    Last publish

    Collaborators

    • ryanmcclure4