Open khanhduy62 opened 3 years ago
Have you read this?
What do you mean by wake/sleep button? For me you just need to catch decline event (it can be decline button on UI, physical decline button, it could be even some macro on shake action or anything else that cause call decline). So you will have this event or you would like to have some different behaviour.
I assume that you do not have any events when app is closed. So you need to check your if your native side works. You can start app in debug mode from xcode and check logs there also I would recommend you to use my fork as there you can see clear picture of event order.
@Romick2005 I'm using "react-native-callkeep" with version "^4.1.0" now To be honest, I do not receive any events if I press wake/sleep button Here is my code:
@Romick2005 I mean I still receive other events such as answer or cancel. However, I cannot get event for pressing wake/sleep button in order to decline a call
@khanhduy62 If after you press the button, the call end, then you should receive the endCall event. If you press the button and the call does not end, then there's no event.
CallKeep only care about call events like answer/reject, other key press events are not in responsibility
Yes @namnm i got endCall event when call reject from lock screen(https://prnt.sc/1rltmuy) but my api calling is not working in case of lock screen. Same code is worked in case of device unlocked, Can you please suggest me any way to resolve it?
@krupalikevadiya Are you relying on component life-cycle? Components are not rendered in this case so all life-cycle did mount, did update... are useless.
Yes @namnm i got endCall event when call reject from lock screen(https://prnt.sc/1rltmuy) but my api calling is not working in case of lock screen. Same code is worked in case of device unlocked, Can you please suggest me any way to resolve it?
You can use my fork and send reject call from objective-c code or o your server.
Yaa @Romick2005 but i need some other parameters to pass in api and which is at JS side so api call through obj-c not working for me.
@krupalikevadiya you can always pass parameters between js and native side using react-native-default-preference package. So I think it is not a problem.
So did you mean we have to store that data in default preference when call is coming and use that data at obj-C side for api Call
You need to store data from JS part first (assume that is authentication token). Then on incoming call you can get call UUID from push token for Android or voip for iOS. Next step is to merge this data and use for sending decline https request to your server from native code.
That means need to store incoming call data at both side Obj-c and Js side right? and based on uuid we get other data of incoming push which we need to send https for reject call.
this
@Romick2005 Do I need to use your fork to implement this functionality(rejecting the call from the IOS native )?
Yes, you can use it.
I'm just wondering how anyone handles pressing wake/sleep button in iOS to decline an incoming call