Comments (5)
I had an older version of the bare expo (37), and I have updated everything to the clean react native project and I have updated all the dependecies to the latests and incoming did receive but while I tried to answered on the locked phone, callkit started but it didn't really answer until I removed this line of code from didFinishLaunchingWithOptions
[RNVoipPushNotificationManager voipRegistration];
from react-native-twilio-phone.
Hi,
this should work, did you make these changes in your AppDelegate.m
?
You can check the example app if you need help.
from react-native-twilio-phone.
@MrHertal tnx, I have managed to get the call using your example app, I will check what I'm doing wrong and write it here and close the issue.
from react-native-twilio-phone.
@MrHertal this is my AppDelegate.m
am I missing something?
// Copyright 2015-present 650 Industries. All rights reserved.
#import "AppDelegate.h"
#import <Firebase.h>
#import <PushKit/PushKit.h>
#import "RNVoipPushNotificationManager.h"
#import "RNCallKeep.h"
#import <UserNotifications/UserNotifications.h>
#import <RNCPushNotificationIOS.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Define UNUserNotificationCenter
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
[RNVoipPushNotificationManager voipRegistration];
[super application:application didFinishLaunchingWithOptions:launchOptions];
return YES;
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
[super applicationWillEnterForeground:application];
}
#pragma mark - Background Fetch
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[super application:application performFetchWithCompletionHandler:completionHandler];
}
#pragma mark - Handling URLs
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [super application:app openURL:url options:options];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
return [RNCallKeep application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}
/* Add PushKit delegate method */
// --- Handle updated push credentials
- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(PKPushType)type {
// Register VoIP push token (a property of PKPushCredentials) with server
[RNVoipPushNotificationManager didUpdatePushCredentials:credentials forType:(NSString *)type];
}
- (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type
{
// --- 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.
}
// --- Handle incoming pushes (for ios >= 11)
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
// --- Retrieve information from Twilio push payload
NSString *uuid = [[[NSUUID UUID] UUIDString] lowercaseString];
NSString *callerName = [payload.dictionaryPayload[@"twi_from"] stringByReplacingOccurrencesOfString:@"client:" withString:@""];
NSString *handle = [payload.dictionaryPayload[@"twi_to"] stringByReplacingOccurrencesOfString:@"client:" withString:@""];
// --- Process the received push
[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
// --- You should make sure to report to callkit BEFORE execute `completion()`
[RNCallKeep reportNewIncomingCall:uuid
handle:handle
handleType:@"generic"
hasVideo:NO
localizedCallerName:callerName
supportsHolding:YES
supportsDTMF:YES
supportsGrouping:YES
supportsUngrouping:YES
fromPushKit:YES
payload:payload.dictionaryPayload
withCompletionHandler:nil];
completion();
}
#pragma mark - Notifications
// REGISTER PUSH NOTIFICATIONS
// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event. You must call the completion handler after handling the remote notification.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
// Required for the registrationError event.
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
[RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for localNotification event
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler
{
[RNCPushNotificationIOS didReceiveNotificationResponse:response];
completionHandler();
}
//Called when a notification is delivered to a foreground app.
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
}
@end
from react-native-twilio-phone.
Sorry, I can't really help because the problem could come from a lot of places.
Since you successfully managed to run the example app, the best thing you can do is trying to implement the same code in your own app step by step.
from react-native-twilio-phone.
Related Issues (20)
- Upgrade ios and android Twilio SDK's to support Umatilla Oregon public edge HOT 1
- Hangup does not work HOT 2
- Video call HOT 1
- two simultaneous calls cause a crash
- Incoming call not working on ios with adhoc profile with voip certificate
- End call listener gets call automatically of RNCallKeep for android when app is in active(foreground and background) both) HOT 2
- The incoming phone call can not connect when app has been killed HOT 1
- incoming call automatic disconnect if android app is in forground.
- Caller is not able to end the call HOT 1
- How to send my own UUID? HOT 2
- Android: Not able to accept the call when call is coming in kill/background state
- can we get call uuid when ringing
- Hide my app name prompt in dialer for outgoing calls
- Official Twilio Voice React Native SDK HOT 2
- When I answer on the incoming call, in the app, I can't join to it. On IOS HOT 2
- In Recents Tab on iOS, my calls show but when I click them, nothing happens HOT 2
- # Warning - 13214 # Dial: Invalid callerId
- [TypeError: null is not an object (evaluating '_reactNativeTwilioPhone.TwilioPhone.register')]
- Android: Not receiving Phone calls When app is in background.
- If I receive an incoming call while the application is open, I do not want to display the notification. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-twilio-phone.