How call declines/rejects ios are handled in ios
Just wondering how anyone handles call declines/rejects when app is not opened in ios?
Have you checked this
I did. I guess it would be better to use delegation and implement required specific ones instead of callback for all of them.
It is just event based callback you can use only one that you are interested in. Because function sendEventWithName is called anyway and you cannot stop it with those delegation.
But what about call initiator hang-up call, how do you handle that situation? Since ios 13 every voip push should fire reportNewIncomingCall. I saw that some people fire this and immediately end call but that doesn't sound reliable. Maby FCM pushes would be the way to go?
Hey @Romick2005 with your fork following functions to end call does not worked as they are not remove swipe to start screen of call from lock screen in iOS and it is working perfectly in case of receiving RNCallKeepPerformAnswerCallAction in didLoadWithEvents.
RNCallKeep.endCall(call_uuid) RNCallKeep.rejectCall(call_uuid) RNCallKeep.endAllCall()
With current version of react-native-callkeep : 4.2.0 above functions to end call working perfectly but didLoadWithEvents does not give RNCallKeepPerformAnswerCallAction event when app load.
Please guide me if you have any idea to figured it out.
It is not clear what do you mean by "not remove swipe to start screen of call from lock screen in iOS"? I assume that you are talking about two cases when app is closed and 1) Phone is locked - need to enter code or faceId to unlock. 2) Phone is unlocked. So there also are two cases how js part of the app receives the event: 1) js loaded then you need to listen NewIncomingCallEvent if event was fired, but was not captured by js side then you have to listen didLoadWithEvents. I am bot sure what is not working for you. Can you please describe your problem with more details.
@remigijusbalc How were you able to handle when call initiator hangs-up the call? Ideally I want to stop showing the call ui screen(CallKit) and display a missed call notification when the call initiator ends the call before it is picked by the receiver.
How can I do this please
@Romick2005 in ios on the lock screen when I accept call it not asking the user to unlock his/her phone like in messenger and in slack or any other app why is that so at least it should ask to enter a pass or unlock using face id
@shaheem-khanzada I think that it is actually required to unlock the phone to start/show app UI. I think you are using faceId and you did not notice how it actually unlock a phone when you look at the phone and doing call accept.
@Romick2005 I just saw when we accept the call from the lock screen our app start but we cannot see the screen but we can see the logs which I implement in the screen where I am navigating user on call accept so it means we can accept the call in lock screen also using react-native am I right?
Your app automatically starts when it receives voip push notification on iOS (or with high priority push on Android). That is actually causing apple CallKit UI to show app, and from this point your app get limited functionality control.
@Romick2005 I mean I can see my consoles in React-Native Screens my simple question is can we connect calls on the lock screen when we press accept on the lock screen
My simple answer is yes.
@Romick2005 Do you know if it's possible to use endCall from AppDelegate.m?
Yes it is possible.
@Romick2005 How do I do that?
[RNCallKeep endCallWithUUID: callUUID reason: [reasonId intValue]]; This answer can also help you.
@Romick2005 how we can listen to this event on AppDelegate like onEndCall press from native screen ?
@Romick2005 Hm, it says: Use of undeclared identifier 'reasonId'
Because it is variable value
@Romick2005 I'm almost there I think. This time I get "Bad receiver type 'int'". This is my code: int reasonId = 6; [RNCallKeep endCallWithUUID: callId reason: [reasonId intValue]];
RNCallKeep endCallWithUUID: callId reason: [reasonId intValue]]
[RNCallKeep endCallWithUUID: callId reason: @6]
It works flawlessly! Thank you so much @Romick2005!!! I would've spent countless more hours on this... If there's anything I can do for you, let me know!
Hi @linus-komnick, can you please share small code sample how do you handle silent push notifications with end call functionality? Also what do you use for sending push notifications?
@Romick2005 Sure, I use this library: https://www.npmjs.com/package/apn
I have a lesson right now, I'll send you the code sample in an hour!
@Romick2005 This is how I do it:
const apn = require('apn');
const options = {
token: {
key: 'APNKey.p8',
keyId: process.env.KEY_ID,
teamId: process.env.TEAM_ID
},
production: true
};
let note = new apn.Notification();
note.alert = "Call canceled by caller";
note.topic = "com.bundle.id";
note.contentAvailable = 1;
const apnProvider = new apn.Provider(options);
apnProvider.send(note, deviceToken);
apnProvider.shutdown();
Great! Thank you! I am also interested how do you handle this silent push notifications on native side in objective-c?
Sure, this is how I do it:
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
NSString *callId = [[NSUserDefaults standardUserDefaults] stringForKey:@"callId"];
int reasonId = 6;
[RNCallKeep endCallWithUUID: callId reason: reasonId];
completionHandler(UIBackgroundFetchResultNewData);
}