Installations
npm install react-native-voip-push-notification
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
18.14.2
NPM Version
9.5.0
Score
41
Supply Chain
49.4
Quality
69.6
Maintenance
50
Vulnerability
94.1
License
Releases
Contributors
Unable to fetch Contributors
Languages
Objective-C (66.28%)
JavaScript (28.82%)
Ruby (4.9%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
react-native-webrtc
Download Statistics
Total Downloads
979,770
Last Day
962
Last Week
6,080
Last Month
24,608
Last Year
246,156
GitHub Statistics
ISC License
218 Stars
78 Commits
85 Forks
13 Watchers
2 Branches
22 Contributors
Updated on Jan 31, 2025
Bundle Size
1.09 kB
Minified
489.00 B
Minified + Gzipped
Package Meta Information
Latest Version
3.3.2
Package Id
react-native-voip-push-notification@3.3.2
Unpacked Size
36.43 kB
Size
10.41 kB
File Count
9
NPM Version
9.5.0
Node Version
18.14.2
Published on
Jul 26, 2023
Total Downloads
Cumulative downloads
Total Downloads
979,770
Last Day
-12.6%
962
Compared to previous day
Last Week
5.5%
6,080
Compared to previous week
Last Month
45.6%
24,608
Compared to previous month
Last Year
19.9%
246,156
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
React Native VoIP Push Notification
React Native VoIP Push Notification - Currently iOS >= 8.0 only
RN Version
- 1.1.0+ ( RN 40+ )
- 2.0.0+ (RN 60+)
!!IMPORTANT NOTE!!
You should use this module with CallKit:
Now Apple forced us to invoke CallKit ASAP when we receive voip push on iOS 13 and later, so you should check react-native-callkeep as well.
Please read below links carefully:
https://developer.apple.com/documentation/pushkit/pkpushregistrydelegate/2875784-pushregistry
When linking against the iOS 13 SDK or later, your implementation of this method must report notifications of type voIP to the CallKit framework by calling the reportNewIncomingCall(with:update:completion:) method
On iOS 13.0 and later, if you fail to report a call to CallKit, the system will terminate your app.
Repeatedly failing to report calls may cause the system to stop delivering any more VoIP push notifications to your app.
If you want to initiate a VoIP call without using CallKit, register for push notifications using the UserNotifications framework instead of PushKit. For more information, see UserNotifications.
Issue introduced in this change:
When received VoipPush, we should present CallKit ASAP even before RN instance initialization.
This breaks especially if you handled almost call behavior at js side, for example:
Do-Not-Disturb / check if Ghost-Call / using some sip libs to register or waiting invite...etc.
Staff from Apple gives some advisions for these issues in the below discussion: https://forums.developer.apple.com/thread/117939
You may need to change your server for APN voip push:
Especially apns-push-type
value should be 'voip'
for iOS 13
And be aware of apns-expiration
value, adjust according to your call logics
About Silent Push ( Background Push ):
VoIP pushes were intended to specifically support incoming call notifications and nothing else.
If you were using voip push to do things other than nootify incoming call
, such as: cancel call
/ background updates
...etc, You should change to use Notification Service Extension, it contains different kind of pushs.
To useBackground Push
to Pushing Background Updates to Your App,
You should:
- Make sure you enabled
Xcode
->Signing & Capabilities
->Background Modes
->Remote Notifications
enabled - When sending background push from your APN back-end, the push header / payload should set:
- content-available = 1
- apns-push-type = 'background'
- apns-priority = 5
Installation
1npm install --save react-native-voip-push-notification 2# --- if using pod 3cd ios/ && pod install
The iOS version should be >= 8.0 since we are using PushKit.
Enable VoIP Push Notification and Get VoIP Certificate
Please refer to VoIP Best Practices.
Make sure you enabled the folowing in Xcode
-> Signing & Capabilities
:
Background Modes
->Voice over IP
enabled+Capability
->Push Notifications
AppDelegate.m Modification
1 2... 3 4#import <PushKit/PushKit.h> /* <------ add this line */ 5#import "RNVoipPushNotificationManager.h" /* <------ add this line */ 6 7... 8 9@implementation AppDelegate 10 11- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 12{ 13 RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 14 15 16 17 // ===== (THIS IS OPTIONAL BUT RECOMMENDED) ===== 18 // --- register VoipPushNotification here ASAP rather than in JS. Doing this from the JS side may be too slow for some use cases 19 // --- see: https://github.com/react-native-webrtc/react-native-voip-push-notification/issues/59#issuecomment-691685841 20 [RNVoipPushNotificationManager voipRegistration]; 21 // ===== (THIS IS OPTIONAL BUT RECOMMENDED) ===== 22 23 24 25 RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"AppName" initialProperties:nil]; 26} 27 28... 29 30/* Add PushKit delegate method */ 31 32// --- Handle updated push credentials 33- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(PKPushType)type { 34 // Register VoIP push token (a property of PKPushCredentials) with server 35 [RNVoipPushNotificationManager didUpdatePushCredentials:credentials forType:(NSString *)type]; 36} 37 38- (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type 39{ 40 // --- The system calls this method when a previously provided push token is no longer valid for use. No action is necessary on your part to reregister the push type. Instead, use this method to notify your server not to send push notifications using the matching push token. 41} 42 43// --- Handle incoming pushes 44- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion { 45 46 47 // --- NOTE: apple forced us to invoke callkit ASAP when we receive voip push 48 // --- see: react-native-callkeep 49 50 // --- Retrieve information from your voip push payload 51 NSString *uuid = payload.dictionaryPayload[@"uuid"]; 52 NSString *callerName = [NSString stringWithFormat:@"%@ (Connecting...)", payload.dictionaryPayload[@"callerName"]]; 53 NSString *handle = payload.dictionaryPayload[@"handle"]; 54 55 // --- this is optional, only required if you want to call `completion()` on the js side 56 [RNVoipPushNotificationManager addCompletionHandler:uuid completionHandler:completion]; 57 58 // --- Process the received push 59 [RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type]; 60 61 // --- You should make sure to report to callkit BEFORE execute `completion()` 62 [RNCallKeep reportNewIncomingCall:uuid handle:handle handleType:@"generic" hasVideo:false localizedCallerName:callerName fromPushKit: YES payload:nil]; 63 64 // --- You don't need to call it if you stored `completion()` and will call it on the js side. 65 completion(); 66} 67... 68 69@end 70
Linking:
On RN60+, auto linking with pod file should work.
Linking Manually
Add PushKit Framework:
- In your Xcode project, select
Build Phases
-->Link Binary With Libraries
- Add
PushKit.framework
Add RNVoipPushNotification:
Option 1: Use rnpm
1rnpm link react-native-voip-push-notification
Note: If you're using rnpm link make sure the Header Search Paths
is recursive
. (In step 3 of manually linking)
Option 2: Manually
- Drag
node_modules/react-native-voip-push-notification/ios/RNVoipPushNotification.xcodeproj
under<your_xcode_project>/Libraries
- Select
<your_xcode_project>
-->Build Phases
-->Link Binary With Libraries
- DragLibraries/RNVoipPushNotification.xcodeproj/Products/libRNVoipPushNotification.a
toLink Binary With Libraries
- Select
<your_xcode_project>
-->Build Settings
- InHeader Search Paths
, add$(SRCROOT)/../node_modules/react-native-voip-push-notification/ios/RNVoipPushNotification
withrecursive
API and Usage:
Native API:
Voip Push is time sensitive, these native API mainly used in AppDelegate.m, especially before JS bridge is up. This usually
(void)voipRegistration
--- register delegate for PushKit if you like to register in AppDelegate.m ASAP instead JS side ( too late for some use cases )(void)didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type
--- call this api to fire 'register' event to JS(void)didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type
--- call this api to fire 'notification' event to JS(void)addCompletionHandler:(NSString *)uuid completionHandler:(RNVoipPushNotificationCompletion)completionHandler
--- add completionHandler to RNVoipPush module(void)removeCompletionHandler:(NSString *)uuid
--- remove completionHandler to RNVoipPush module
JS API:
registerVoipToken()
--- JS method to register PushKit delegateonVoipNotificationCompleted(notification.uuid)
--- JS mehtod to tell PushKit we have handled received voip push
Events:
'register'
--- fired when PushKit give us the latest token'notification'
--- fired when received voip push notification'didLoadWithEvents'
--- fired when there are not-fired events been cached before js bridge is up
1 2... 3 4import VoipPushNotification from 'react-native-voip-push-notification'; 5 6... 7 8class MyComponent extends React.Component { 9 10... 11 12 // --- anywhere which is most comfortable and appropriate for you, 13 // --- usually ASAP, ex: in your app.js or at some global scope. 14 componentDidMount() { 15 16 // --- NOTE: You still need to subscribe / handle the rest events as usuall. 17 // --- This is just a helper whcih cache and propagate early fired events if and only if for 18 // --- "the native events which DID fire BEFORE js bridge is initialed", 19 // --- it does NOT mean this will have events each time when the app reopened. 20 21 22 // ===== Step 1: subscribe `register` event ===== 23 // --- this.onVoipPushNotificationRegistered 24 VoipPushNotification.addEventListener('register', (token) => { 25 // --- send token to your apn provider server 26 }); 27 28 // ===== Step 2: subscribe `notification` event ===== 29 // --- this.onVoipPushNotificationiReceived 30 VoipPushNotification.addEventListener('notification', (notification) => { 31 // --- when receive remote voip push, register your VoIP client, show local notification ... etc 32 this.doSomething(); 33 34 // --- optionally, if you `addCompletionHandler` from the native side, once you have done the js jobs to initiate a call, call `completion()` 35 VoipPushNotification.onVoipNotificationCompleted(notification.uuid); 36 }); 37 38 // ===== Step 3: subscribe `didLoadWithEvents` event ===== 39 VoipPushNotification.addEventListener('didLoadWithEvents', (events) => { 40 // --- this will fire when there are events occured before js bridge initialized 41 // --- use this event to execute your event handler manually by event type 42 43 if (!events || !Array.isArray(events) || events.length < 1) { 44 return; 45 } 46 for (let voipPushEvent of events) { 47 let { name, data } = voipPushEvent; 48 if (name === VoipPushNotification.RNVoipPushRemoteNotificationsRegisteredEvent) { 49 this.onVoipPushNotificationRegistered(data); 50 } else if (name === VoipPushNotification.RNVoipPushRemoteNotificationReceivedEvent) { 51 this.onVoipPushNotificationiReceived(data); 52 } 53 } 54 }); 55 56 // ===== Step 4: register ===== 57 // --- it will be no-op if you have subscribed before (like in native side) 58 // --- but will fire `register` event if we have latest cahced voip token ( it may be empty if no token at all ) 59 VoipPushNotification.registerVoipToken(); // --- register token 60 } 61 62 // --- unsubscribe event listeners 63 componentWillUnmount() { 64 VoipPushNotification.removeEventListener('didLoadWithEvents'); 65 VoipPushNotification.removeEventListener('register'); 66 VoipPushNotification.removeEventListener('notification'); 67 } 68... 69} 70
Original Author:
License
ISC License (functionality equivalent to MIT License)

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: ISC License: LICENSE:0
Reason
Found 7/18 approved changesets -- score normalized to 3
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 21 are checked with a SAST tool
Score
3.4
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-native-voip-push-notification
@sendbird/calls-react-native
Sendbird Calls SDK for React Native: Empower React Native apps with seamless audio, video, and group calling. Build interactive communication easily.
react-native-voip-call-2
webrtc background supported call notifications
react-native-voip-push-receiver
VoIP push notification handler for Android
react-native-voips-calls
webrtc background supported call notifications