react-native-webrtc / react-native-callkeep

iOS CallKit framework and Android ConnectionService for React Native
ISC License
901 stars 439 forks source link

Accept call and can't start app when device locked or sleep ( iOS ) #301

Open caglardurmus opened 3 years ago

caglardurmus commented 3 years ago

Bug report

Description

I want to accept call and then start the application. It works perfect when the device not locked or not sleep mode but when its on locked or sleep mode, it does not start the application when i accept. I can get notification with voip. When i accept it if the user have password callkeep can't start the application.

Expectation

When i accept the call (at sleep or locked mode) user pin his/her pass and then application start.

Versions

- Callkeep: 3.1.1
- React Native: 0.62.1
- iOS: 14
- Phone model: iPhone 7 
nerdymind-dev commented 3 years ago

Running into same problem. Answer goes into infinite loop since app is not available to answer/no way to launch if quit.

caglardurmus commented 3 years ago

Any suggestions ?

namnm commented 3 years ago

When phone is locked, there's no way to open app directly from PN. https://stackoverflow.com/questions/41740139

There will be an icon in the native dialer, if user click on that icon, the phone will show unlock screen and if user unlock the phone, app will be shown. There's a config imageName when you setup CallKeep, which map to the objective C iconTemplateImageData to customize the image of that icon.

qburst-subins commented 3 years ago

@namnm Can you check how whatsApp handle this scenario?

namnm commented 3 years ago

@subinsuresh I dont use whatsapp, so I dont know its behavior. Can you add some tests and capture a video if possible? So let me sum up:

hussainsherwani commented 3 years ago

@caglardurmus did you find any solution ? , for me it happened randomly most of the case when I open the lock app already opened and navigate to call screen but in some time it never open the application. @namnm can this be a problem #346 , if add delay what will be your suggestion ?

caglardurmus commented 3 years ago

@caglardurmus did you find any solution ? , for me it happened randomly most of the case when I open the lock app already opened and navigate to call screen but in some time it never open the application. @namnm can this be a problem #346 , if add delay what will be your suggestion ?

Nope, i didn't find any solution. I used delay but its not working. It works if user answer the phone after 1.5 sec. If user answer it fast it doesn't work.

timorss commented 2 years ago

@caglardurmus did you find any solution ? , for me it happened randomly most of the case when I open the lock app already opened and navigate to call screen but in some time it never open the application. @namnm can this be a problem #346 , if add delay what will be your suggestion ?

Nope, i didn't find any solution. I used delay but its not working. It works if user answer the phone after 1.5 sec. If user answer it fast it doesn't work.

Happens to me as well.

danilvalov commented 2 years ago

@caglardurmus

Nope, i didn't find any solution. I used delay but its not working. It works if user answer the phone after 1.5 sec. If user answer it fast it doesn't work.

Do you have any solution for this issue? I have the same problem: Answer/Reject buttons don't work for background/killed app state in first 1.5-5 seconds when app isn't runned yet.

MinhThu100200 commented 1 year ago

I need a help =(( Do you have any solution for this issue?

namnm commented 1 year ago

@MinhThu100200 On ios, if the phone is locked, when answer the call it will display the CallKit UI. You can put an icon from your app to the screen as below, if user click the icon, it will request for unlock and open the app afterward: 32146144-8d545e5c-bca9-11e7-894d-b3cc516dc7ee

There could be a hacky solution: that if you enable video in RNCallKeep.displayIncomingCall Then it will request for unlock immediately right after answer the call.

There is also another solution which I believe Whatsapp is using as the community has mentioned above. Use PushNotification to notify incoming call instead of CallKit, then if user press the notification, it will request for unlock and open the app. But then you could loose some of the feature of CallKit, such as notify on hold when there is incoming GSM call, or switch between multiple calls.

MinhThu100200 commented 1 year ago

@namnm When I use IP 7 plus, everything is oke, but with others when I accept call, my app cannot open but I open my app myself. everything that I use to handle calling is running. I have no ideas about that =((((

namnm commented 1 year ago

@MinhThu100200 Please be more specific. When you performed those testings, was the phone locked or not, if locked with passcode or not?

Please check again and provide more details if possible, especially above questions for the iPhone7 and others you mentioned.

No one can help you if you provide little to no information at all.

MinhThu100200 commented 1 year ago

@namnm yeah, thanks. When my app state is background or kill. And I have a phone call that is incoming. Then I answer it but my app doesn't launch. However, my handling in js code that still run. So my issue that is "accepting call but my app doesn't launch when my device still runs or locked". With iphone 7 plus, everything is okie, app always launch when I accept call. Please help me =(((

MinhThu100200 commented 1 year ago

maybe because of version os. when I use my app with ios 16 or lower (15.x). everything is okie. But with ios 16.6, when I accept call, my app doesn't open.

namnm commented 1 year ago

@MinhThu100200 Please run your app in debug mode with logger and see if there's any error? You can add this package to catch the error: https://github.com/a7ul/react-native-exception-handler I guess your app could be crashed during the answer, adding the above package and configuring to catch native exception then it could help preventing the crash.

You can also use the Console app to view the log of your iPhone in realtime, with this you can also view the log of production bundle ipa without running in debug: https://support.apple.com/guide/console/welcome/mac https://support.apple.com/guide/console/cnsl1012/mac

MinhThu100200 commented 12 months ago

@namnm thank sir. I will check and follow your suggestion. thank u so much~

Irfanwani commented 3 weeks ago

@MinhThu100200 On ios, if the phone is locked, when answer the call it will display the CallKit UI. You can put an icon from your app to the screen as below, if user click the icon, it will request for unlock and open the app afterward: 32146144-8d545e5c-bca9-11e7-894d-b3cc516dc7ee

There could be a hacky solution: that if you enable video in RNCallKeep.displayIncomingCall Then it will request for unlock immediately right after answer the call.

There is also another solution which I believe Whatsapp is using as the community has mentioned above. Use PushNotification to notify incoming call instead of CallKit, then if user press the notification, it will request for unlock and open the app. But then you could loose some of the feature of CallKit, such as notify on hold when there is incoming GSM call, or switch between multiple calls.

i think the first solution is the best way to handle this. Let's talk about the other two solutions first (hacks infact): 1) Setting the call as video call doesn't always work as i tried it + it gives user a wrong idea about the call, so not an optimal solution. 2) Sending a push notification still requires user interaction then opening the phone (phone lock) and then the app will show.

First option is just better, because: 1) It provides native UI thus giving a better calling experience, we can simply add listeners to make all the action buttons work (or can disable them accordingly, though i don't know how, but i saw in google meet, the keypad is disabled as DTMF is not used there). 2) user doesn't need to open app to interact with the call, atleast call is setup before bringing the app to foreground, so if you have some extra features for which you want to open the app, the user can simply click the app icon shown in the native call UI, check this also. 3) After iOS 13, apple made it mandatory to report call to callkit when receiving a voip push, so it is a reliable solution for a calling app than using background messaging.