react-native-callkeep icon indicating copy to clipboard operation
react-native-callkeep copied to clipboard

Handling Ringning State with selfManaged on Android

Open orestesparra opened this issue 1 year ago • 1 comments

Bug report

  • [ x] I've checked the example to reproduce the issue.

  • Reproduced on:

  • [x ] Android

  • [ ] iOS

Description

I’m currently using selfManaged in Android. When the phone is receiving an incoming call and is in the RINGING state, my app also receives a call, but the library is unable to manage this scenario properly.

I propose two possible solutions:

Solution 1:

I noticed in the code that there is a function public void onCallStateChanged.

Can I add a new action "RNCallKeepHasRingingCall" and, in the switch case (TelephonyManager.CALL_STATE_RINGING) (TelephonyManager.CALL_STATE_RINGING), include the following line of code?:

RNCallKeepModule.this.sendEventToJS("RNCallKeepHasRingingCall", args);

This would allow me to send an event to JavaScript notifying when the phone is in the RINGING state.

Additionally, I will create another event for the TelephonyManager.CALL_STATE_IDLE case to notify when the phone returns to the IDLE state.

Solution 2:

Create a private boolean property, hasRinging, and update its value in the aforementioned cases in solution 1. Then, I can export the value of this property via a function to JS

Please let me know which approach you would prefer so I can proceed with creating a PR

Regards Orestes

Steps to Reproduce

Versions

- Callkeep: 4.3.14
- React Native: 0.75.2
- iOS: 17
- Android: 34
- Phone model: 

Logs

Paste here

orestesparra avatar Oct 07 '24 19:10 orestesparra

did u get the self manage mode to work? May I know how to implement it, ive search a lot but cant find shi on how to implement self manage mode. @orestesparra

AnasPlusAnas avatar Jun 19 '25 07:06 AnasPlusAnas