react-native-webrtc / react-native-callkeep

iOS CallKit framework and Android ConnectionService for React Native
ISC License
884 stars 431 forks source link

unlock phone when swipe to answer an incoming call #319

Open vitorlsouza opened 3 years ago

vitorlsouza commented 3 years ago

Bug report

Description

when receiving a call and the app is in background and phone locked when you swipe to answer it doesnt swipe to unlock and answer, just answer so you're presented the swipe to unlock normal apple screen when your phone wakes up.

when the phone wakes up, the app does not launch, because it already tried to launch when the incoming call was answered and the phone was blocked.

Steps to Reproduce

answer a call when the phone is locked.

Versions

- Callkeep: 3.1.1
- React Native: 0.60.4
- iOS: 14.1
- Android:
- Phone model: iPhone 11

Logs

Paste here
jason-shen commented 3 years ago

i think thats the way it is, there is no way around this, you could write a special function when the app is killed or background, i think thats the only way around this

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.

tuneerclixlogix commented 3 years ago

Have you found any solution for this ? I am also facing same issue in ios On lockscreen i swipe to answer call then unlock the phone but the app was not opened.

qburst-subins commented 3 years ago

In WhatsApp, it's directly Launching the application. It's not stuck on the Callkit UI when device is locked state.

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:

JayPerfetto commented 3 years ago

Has anyone found a resolution to this bug? I face the exact same issue in flutter using CallKeep, and it seems to be an extremely common problem / use case that no one has figured out even remotely....Slack, FBMessenger, Whatsapp, WeChat, they all seem to have found a workaround and yet we cannot

beqramo commented 2 years ago

any help here?

namnm commented 2 years ago

@JayPerfetto @beqramo I have just downloaded Whatsapp and tested the behavior. Apparently they didnt use VoIP CallKit, just regular push notification. When you click on the notification it will unlock via FaceID and app open.

Romick2005 commented 2 years ago

@JayPerfetto @beqramo I have just downloaded Whatsapp and tested the behavior. Apparently they didnt use VoIP CallKit, just regular push notification. When you click on the notification it will unlock via FaceID and app open.

You are partly right. Your scenario describe iOS behaviour, but for Android it starts audio stream without unlocking the phone (the same is in iOS, but you need to swipe to accept a call). Even in iOS you can start audio session when phone is locked. Just tested this in Whatsapp.

namnm commented 2 years ago

@Romick2005 In our app, we are using this callkeep package. Just general ios voip callkit, if user needs to open the app then click on the app icon. For android we use self manage. This library has been doing a great job for us.

There is one thing on android that in the case app killed, it take a considered long time to show the call. I guess it need to initialize the js bridge and things. We want to customize the lib to let it show call in native java code instead of js code but havent had time to do that.

beqramo commented 2 years ago

@namnm I know it isn't related to this but how did you send VoIP notifications? I'm using Firebase and it doesn't support that. I don't want to use any server, serverless would be the best solution for me.

Thanks in advance

namnm commented 2 years ago

@beqramo Take a look at this, you can try download this app to test your PN locally: https://github.com/onmyway133/PushNotifications/blob/master/components/InputComponent.js#L199-L245

If you have a nodejs server, there is a package which they use in the above code: https://www.npmjs.com/package/apn

Some notes:

beqramo commented 2 years ago

Thanks for your answer, my entire infrastructure is based on Firebase (Firestore, messaging, storage). and for notification handling I use https://github.com/zo0r/react-native-push-notification.
so I'm looking for a workaround for a custom server.

I want to mention also that it is really bad that Firebase doesn't support VoIP.

I will try to use that node package if I were unable to find anything.

Thanks.

Romick2005 commented 2 years ago

We switched from Firebase to OneSignal and everything run smoothly after that. It also supports voip notifications.

hariks789 commented 2 years ago

Has anyone found a resolution to this bug? I face the exact same issue in flutter using CallKeep, and it seems to be an extremely common problem / use case that no one has figured out even remotely....Slack, FBMessenger, Whatsapp, WeChat, they all seem to have found a workaround and yet we cannot

@subinsuresh @JayPerfetto I am using react-native-push-notifications along with USE_FULL_SCREEN_INTENT to present a local notification using FCM data only notifications.. Refer this PR https://github.com/zo0r/react-native-push-notification/pull/2112

This will launch the app even in lock-screen and you can present your own call UI using onNotification listener. When you exit the app the screen goes back to lock screen. Just like Whatsapp Only downside is that the app will always display on top of lockscreen due to this permission. Like your app is in foreground and you manually lock phone and you turn the screen back on, you will still be able to access app without lock/pass code. Reference https://stackoverflow.com/questions/60876523/how-to-lock-android-device-after-unlocking-with-setshowwhenlockedtrue

Madhav131 commented 1 year ago

@hariks789 How do I solve this problem please any help?

reubber commented 1 year ago

i solved this problem here by adding these 2 properties in the androidManifest file in MainActivity:

but when i press any notification it starts the app as well without ask passward lockscreen :/