react-native-webrtc / react-native-voip-push-notification Goto Github PK
View Code? Open in Web Editor NEWReact Native VoIP Push Notification - Currently iOS only
License: ISC License
React Native VoIP Push Notification - Currently iOS only
License: ISC License
When I try to register the completion handler I continue to get the following error
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[RNVoipPushNotificationManager addCompletionHandler:completionHandler:]: unrecognized selector sent to class 0x102e4fcb8'
If i clikc on the function
[RNVoipPushNotificationManager addCompletionHandler:uuid completionHandler:completion];
I can see it exists.. I'm not sure what is happening. Any ideas?
I am using OneSignal to send push notifications.
When I build my app for release mode, notifications arrive just fine. But when building for debug, the didReceiveIncomingPushWithPayload
is never called and the notification is ignored. Although on OneSignal it says the notification was delivered.
i tried .aiff, .mp3 format and placed my audio in resource/
and setting the audio name to soundName presentLocalNotification({soundName: 'azan_1.mp3'}),
but it still playing the default sound
can anyone give clear instruction how to set custom sound when notification arrive as there is no detail provide in package instruction
I'm working with iOS for VoIP notification and I've used react-native-voip-push-notification to handle my VoIP notification.
I'm able to trigger localNotification using the following code:
VoipPushNotification.addEventListener('notification', (notification) => {
console.log('Notification:::', notification)
VoipPushNotification.presentLocalNotification({
alertBody: notification.getMessage()
});
});
but local Notification listener is not logging out any notifications:
VoipPushNotification.addEventListener('localNotification', (notification) => {
// --- when user click local push
console.log('Local Notification:::', notification)
});
I've enabled push notification, Background mode (VoIP notification, Background fetch, and Remote notification) from xCode capabilities. I'm using RN0.59.10. Is there something I'm missing?
Thanks in advance
#30
iOS seems to change how VOIP Push notifications have to be handled. Apparently the app now has to almost immediately (as in basically first thing after notification) start the call notification, otherwise it won't respond.
Not sure if this package needs to be updated or if RN needs changing. Please LMK if you want any logs and I will happily post them here.
I'm working with iOS for VoIP notification and I've used react-native-callkit and react-native-voip-push-notification to handle my VoIP calls.
I'm able to trigger localNotification using the following code:
VoipPushNotification.presentLocalNotification({alertBody: "Local Notification Test"})
but my localNotification listener is not logging out any notifications (my app is on):
VoipPushNotification.addEventListener('localNotification', notification => {
console.log('localnotification notify : ', notification)
});
I've enabled push notification, Background mode (VoIP notification, Background fetch, and Remote notification) from x-code capabilities. I'm using RN0.58. Is something I'm missing?
Thanks in advance
Hello,
I got an error of use of "Use of undeclared identifier 'pushRegistry'" whenever i write below code. Please help me to find out from this.
react-native-voip-push-notification : 2.1.0
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Firebase.h>
#import "RNSplashScreen.h"
#import "RNCallKeep.h"
#import <PushKit/PushKit.h>
#import "RNVoipPushNotificationManager.h"
#import "RNFirebaseNotifications.h"
#import "RNFirebaseMessaging.h"
#if DEBUG
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif
@implementation AppDelegate
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
/* Add PushKit delegate method */
// --- Handle updated push credentials
Currently listening on the "notification" event and it appears as though I don't get the notification when the app is running in the background (not closed) but if you close the app then it gets notifications absolutely fine.
Is there another event I should be listening for? or should I be setting up the appdelegate differently to whats in the readme?
When trying to remove the event listener it's not removing so when mounting and unmount I;m getting doubled notifications
code
componentWillMount() {
VoipPushNotification.addEventListener("notification", notification => {
const data = notification.getData();
this.notificationSwitch(data, notification);
});
}
componentWillUnmount() {
VoipPushNotification.removeEventListener("notification", () => {
console.log("removed");
});
}
Also tried
componentWillMount() {
VoipPushNotification.addEventListener("notification", notification => {
const data = notification.getData();
this.notificationSwitch(data, notification);
});
}
componentWillUnmount() {
VoipPushNotification.removeEventListener("notification");
}
Hi, is it possible to revoke old voip token and create a new?
We use voip-push-notification
& react-native-callkeep
on iOS to awake app from background mode / closed state when received a voip call.
It work fine in background mode. But when app in closed state. Nothing happen, no notifcation, no automation awake app.
We met this issue from version 2.0.0 and react native 0.60.6. V1 and react-native 0.59 work fine.
any ones met the same issue with us? Can we resolve this problem?
I am new to the IOS react land. I have react-native-push-notifications work but am trying to add voip. Is there a simple example available somewhere? My main question right now is what Add PushKit delegate method
means in the appDelegate.m.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
/* Add PushKit delegate method */
When I get An Incoming VOIP Notification on IOS devices when App Is in Background mode, App Is Crashed Every time When I Reject the Notification. But Works Fine On Accept Call.
And Working Fine On Foreground Mode For Both Accept and reject.
XCODE LOGS:
2020-02-13 12:12:19.305827-0500 555 Phone RN[3791:1852152] Apps receving VoIP pushes must post an incoming call (via CallKit or IncomingCallNotifications) in the same run loop as pushRegistry:didReceiveIncomingPushWithPayload:forType:[withCompletionHandler:] without delay.
2020-02-13 12:12:19.307019-0500 555 Phone RN[3791:1852152] *** Assertion failure in -[PKPushRegistry _terminateAppIfThereAreUnhandledVoIPPushes], /BuildRoot/Library/Caches/com.apple.xbs/Sources/PushKit/PushKit-37/PKPushRegistry.m:343
2020-02-13 12:12:19.307351-0500 555 Phone RN[3791:1852152] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push callback.'
*** First throw call stack:
(0x18463d80c 0x184365fa4 0x18453fc4c 0x1849756f4 0x19831ba5c 0x10241ebd8 0x10242d858 0x19831a9cc 0x10241d7fc 0x10241ebd8 0x10242cc34 0x1845bb3a8 0x1845b639c 0x1845b58a0 0x18e50d328 0x1886a6740 0x100646844 0x184440360)
libc++abi.dylib: terminating with uncaught exception of type NSException
I'm not able to use push notifications with custom sounds.
I've added the caf file in my app resource bundle, which is also included in the copy bundle resources.
The soundname in my apn is exactly the same as provided in the resource bundle.
Any idea what i could do wrong? or is there any tutorial to follow which explains how to install a custom sound for notifications.
I'm trying to get VoIP notification using RN-VoIP-PN library so I've generated my VoIP token using following method:
VoipPushNotification.addEventListener('register', token => {
console.log('VOIP TOKEN: ', token)
})
but my VoIP token was getting rejected by APN server saying that it's an invalid token. After seeing this I've tried using PushNotificationIOS for token and generated a token using the following code:
PushNotificationIOS.addEventListener('notification', (token)=>{
console.log('PushNotificationIOS token: ', token)
})
and surprisingly this token was different from VoipPushNotification
generated token and my APN server accepted this token.
There are multiple questions that I want to clarify
VoipPushNotification
used PushNotificationIOS
to generate there token?Thanks in advance
Nothing is logged when we do
VoipPushNotification.addEventListener('localNotification', (notification) => {
console.log(notification)
})
VoipPushNotification.presentLocalNotification({
alertBody: "hello! "
});
Also, register event is never triggered.
VoipPushNotification.addEventListener('register', (token) => {
// send token to your apn provider server
});
Please check
Someone can show how to call CallKeep in ios 13.4 then the application was killed?
"react-native": "0.61.5",
"react-native-callkeep": "3.0.10",
"react-native-voip-push-notification": "^2.0.0",
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion { // --- Process the received push [RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type]; // --- NOTE: apple forced us to invoke callkit ASAP when we receive voip push // --- see: react-native-callkeep // --- Retrieve information from your voip push payload NSString *uuid = payload.dictionaryPayload[@"uuid"]; NSString *callerName = [NSString stringWithFormat:@"%@ (Connecting...)", payload.dictionaryPayload[@"callerName"]]; NSString *handle = payload.dictionaryPayload[@"handle"]; NSDictionary *extra = [payload.dictionaryPayload valueForKeyPath:@"call.boxt.one"]; // --- You should make sure to report to callkit BEFORE execute
completion()[RNCallKeep reportNewIncomingCall:uuid handle:handle handleType:@"generic" hasVideo:false localizedCallerName:callerName fromPushKit: YES]; completion(); }
Hi there,
i'm trying to intregrate voip push notification with callkeep. and i'm sending data like this:
{
"aps": {
"alert": "Hello Push",
"sound": "default"
},
"uuid": "12212",
"callerName": "Samad",
"handle": "Task",
"extra": {}
}
but when my app recieve a push notification i got an exception in main.m file
Thread 1: Exception: "-[CXProvider reportNewIncomingCallWithUUID:update:completion:]: parameter 'UUID' cannot be nil"
this is what i got from notification listner:
can anyone tell me what i'm doing wrong?
"react-native": "0.63.1",
"react-native-callkeep": "^3.1.1",
"react-native-voip-push-notification": "^2.1.0",
How does one go about unregistering the device (for example, on Log Out).
Everything works fine when app is running in foreground, method gets called and call screen shows. If I minimize the app though nothing gets called and nothing gets logged even. I have read over the readme a million times and followed every step.
Added this:
Background Modes -> Voice over IP
Any thoughts? Running iOS 13.4.1 on iPhone XR w/ RN 0.61.5
I think it might be worth having a note in the readme that Apple will reject apps using this method if you are only using it for push notifications. That is, you must’ve using voice over IP services if you enable the voip background mode, or your app will get rejected.
seems not yet support typescript?
Thanks
Hi @ianlin ,
First, Thanks for this Library!
Im having issue when debugger
is ON, this is not firing, Im not getting the device token.
componentWillMount () {
VoipPushNotification.addEventListener('register', this._onRegister)
}
componentWillUnmount () {
VoipPushNotification.removeEventListener('register', this._onRegister)
}
_onRegister(token) {
console.tron.log({ token })
this.setState({
pushId: token
})
}
Else if debugger is ON the token is there:
Though as I check my xcode console i'm seeing my token is registered.
Receiving the notification even the
debugger
is OFF works as expected.
Cheers!
The app crashes when it gets to this line of code:
VoipPushNotification.registerVoipToken();
This is the error in the XCode console:
2020-04-30 19:20:49.552892-0400 myApp[265:6055] [RNVoipPushNotificationManager] voipRegistration
2020-04-30 19:20:49.633725-0400 myApp[265:6055] -[AppDelegate pushRegistry:didUpdatePushCredentials:forType:]: unrecognized selector sent to instance 0x283c83580
2020-04-30 19:20:49.634672-0400 myApp[265:6055] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate pushRegistry:didUpdatePushCredentials:forType:]: unrecognized selector sent to instance 0x283c83580'
*** First throw call stack:
(0x1bff0f180 0x1bf0e79f8 0x1bfe2b9bc 0x1ec728220 0x1bff149c8 0x1bff1665c 0x1e16ae0b8 0x1048776f4 0x104878c78 0x1048866fc 0x1bfea0b20 0x1bfe9ba58 0x1bfe9afb4 0x1c209c79c 0x1ec6fcc38 0x1009a0d34 0x1bf95e8e0)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
When receive notification app get crash with following error.
libc++abi.dylib: terminating with uncaught exception of type NSException
First of all thank you for package :)
My app can receive push notifications when phone screen is on. (app is closed also)
But if I turn off the screen wait like 10-15 seconds I can't get the PN. Is that an expected behavior? I guess not because I can get calls from whatsapp even (whatsapp is closed + screen is off)
Any ideas how to solve this?
I am running my app on testflight.
i try to install and run VoipPushNotification.registerVoipToken() so i got registerVoipToken() is not a function but VoipPushNotification.requestPermissions() work perfectly.
RN 0.59.10
If app killed and screen locked [RNCallKeep][reportNewIncomingCall] doesn't open call screen.
Maybe You know how can I fix it?
ios: 13
in logs:
17:35:25.630074+0500 appname [RNVoipPushNotificationManager] constantsToExport currentState = background
17:35:28.160530+0500 appname RNInCallManager.init(): initialized
17:35:28.162852+0500 appname RNInCallManager._checkRecordPermission(): recordPermission=granted
17:35:28.166609+0500 appname RNInCallManager._checkCameraPermission(): using iOS7 api. cameraPermission=undetermined
17:35:28.289386+0500 appname [RNCallKeep][setup] options = {
appName = appname;
maximumCallGroups = 1;
supportsVideo = 0;
}
17:35:28.290937+0500 appname [RNCallKeep][getProviderConfiguration]
7:35:29.664081+0500 onlinepbx [react-native-permissions] ios.permission.MICROPHONE permission checked: granted
17:35:29.664110+0500 appname [RNVoipPushNotificationManager] voipRegistration
17:35:29.666877+0500 appname [RNCallKeep][reportNewIncomingCall] uuidString = 2452d430-bfca-4068-9cda-3d98f85ef878
17:35:29.667721+0500 appname [RNVoipPushNotificationManager] didReceiveIncomingPushWithPayload payload.dictionaryPayload = {
aps = {
alert = "call";
};
"caller_id_name" = 04391076;
handle = 04391076;
type = call;
uuid = "2452d430-bfca-4068-9cda-3d98f85ef878";
}, type = PKPushTypeVoIP
17:35:29.667749+0500 appname [RNVoipPushNotificationManager] handleRemoteNotificationReceived notification.userInfo = {
aps = {
alert = "call";
};
"caller_id_name" = 04391076;
handle = 04391076;
type = call;
uuid = "2452d430-bfca-4068-9cda-3d98f85ef878";
}
Specifically, im interested in implementing push notification when app is killed by the user.
I ve used this module for voip PN. All is good with iOS 9 and iOS 10, but on iOS 11 I can't receive voip PN also can't see voip token. How I can resolve this ?
Thanks for this project, looking forward to giving it a ago.
I'm currently using regular push notifications but am finding them to be quite unreliable, especially the silent type that interact with my app and deliver some data, hence looking at voip notifications now. My question is, are VOIP messages different in any way from "normal" apple push notifications?
I have the following code that triggers the local notification but need an event listener that listeners for when it's been opened / app opens from the notifications
VoipPushNotification.presentLocalNotification({
alertBody: notification.getMessage()
});
Whats the correct syntax to use when configuring action buttons?
i know we have a method notification.getMessage() to retrieve the alertBody, but is there a method to retrieve action buttons?
This is what im doing:
VoipPushNotification.presentLocalNotification({
alertBody: notification.getMessage(),
alertAction: 'Accept',
applicationIconBadgeNumber: 1,
category: 'incoming_call',
});
But still, no action button is displayed and there is no badge number.
Followed the install instructions per the documentation, and Xcode yields the following error when building:
'React/RCTBridgeModule.h' file not found
from the file 'RNVoipPushNotificationManager.m'.
Any guidance as to why this might be happening would be greatly appreciated!
Below is the error:-
[!] CocoaPods could not find compatible versions for pod "React/Core":
In Podfile:
RNVoipPushNotification (from ../node_modules/react-native-voip-push-notification
) was resolved to 1.1.4, which depends on
React/Core
None of your spec sources contain a spec satisfying the dependency: React/Core
.
You have either:
pod repo update
or with pod install --repo-update
.Note: as of CocoaPods 1.0, pod repo update
does not happen on pod install
by default.
If anyone found this error then open node modules and navigate to react-native-voip-push-notification and open podspec file and change s.dependency 'React/Core' to s.dependency 'React-Core'.
But my request is to update this asap as i have waste my 8 hrs on this.
Hi, I think it would be great if you can make registerUserNotification
as optional.
react-native-firebase
. That's mean I already registered for user notification. So I do not want to override my settings when setting up voip push.[app registerUserNotificationSettings:notificationSettings]
is deprecated. Use UserNotifications Framework's [UNUserNotificationCenter requestAuthorizationWithOptions:completionHandler:]
and [UNUserNotificationCenter setNotificationCategories:]
insteaddidReceiveIncomingPushWithPayload() it's triggered only in foreground.
Here is my appdelegate
`/**
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Firebase.h>
#import "RNCallKeep.h"
#import <PushKit/PushKit.h> /* <------ add this line /
#import "RNVoipPushNotificationManager.h" / <------ add this line */
@implementation AppDelegate
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"ceva"
initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
(NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
// Handle updated push credentials
}
// Handle incoming pushes
(void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
// Process the received push
[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
NSString *uuid = [[[NSUUID UUID] UUIDString] lowercaseString];
NSString *callerName = @"nume";
NSString *handle = @"ext";
NSLog(@"RNVoipPushNotificationManager ----- pushRegistry received");
[RNCallKeep reportNewIncomingCall:uuid handle:handle handleType:@"generic" hasVideo:false localizedCallerName:callerName fromPushKit: YES];
completion();
}
(BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler
{
return [RNCallKeep application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
}
@EnD
`
Hi, I'm having the issue that my app requests permission normally in development but after archived to ipa it doesnt request permission any more. Any idea? Thanks.
I'm encountering super weird bug. Basically, when I kill the app and send pushes, on the first push callKit is never shown, but it's shown on the following ones. I built the app in release mode, iOS version: 10.3.3.
Has anyone encountered this issue? Anyone solved it?
It might be related to issue #14 .
Looks like Apple have changed some of there configuration on iOS13 and Xcode11, this is the full error
Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push callback.
Are there any changes that need to be made to the package
Is the notification listener called when the app is closed/killed (not in background) since this is in the JS side?
I was config successfully, but this listener never trigger.
Here is my code:
VoipPushNotification.addEventListener('register', token => {
});
I have implemented this library with the RNCallKit library and nearly every time a notification is sent to the device, the notification is received and Call Kit does it's magic. However, there have been instances where after the app launches I kill the app, lock the device and let it go to sleep, then send a notification again. The notification is not received. If I simply wake the device (not unlock it, just let the screen light up), then the notification comes through and CallKit works. As far as I can tell, the didReceiveIncomingPushWithPayload in AppDelegate.m is not called. The notification is of type VoIP. Has anyone figured this out?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.