react-native-voip-call icon indicating copy to clipboard operation
react-native-voip-call copied to clipboard

onCallAnswer Android not getting called in killed state.

Open anjandaffo opened this issue 5 years ago • 8 comments
trafficstars

In Android, onCallAnswer hook not get called when the app is killed.

On receive of push notification voip incoming call notification is showing with sound. When we click on accept button app is coming to foreground and still, notification is showing with sound playing.

I am not getting RNVoipCall.onCallAnswer(data => { console.log(data); }); called so I can call this below method.

RNVoipCall.endAllCalls(); RNVoipCall.stopRingtune();

In the background state, it is working fine.

anjandaffo avatar Aug 10 '20 06:08 anjandaffo

I was also facing this problem until I discovered that the problem is my device. Check if you have autostart permission enabled for your app.

Lekxel avatar Aug 12 '20 06:08 Lekxel

@Lekxel I checked my device setting and autostart setting is disabled for the app.

On Accept button of notifications app is automatically restarted and comes to forground. The issue is onCallAnswer is not get called. After the app restarted notifications and sounds is still alive.

How to automatically enable the autostart setting? I checked WhatsApp autostart setting is enabled.

anjandaffo avatar Aug 12 '20 18:08 anjandaffo

I really don't understand what you mean.

You cannot programmatically enable autostart. But there are some packages that allow you to do that for some limited number of device brands.

Lekxel avatar Aug 12 '20 18:08 Lekxel

I am trying this library for VOIP call notification in Android, and it is showing the notification with the "Answer" and "Decline" button along with ring tone correctly. Clicking the "Answer" button opens the app, but it doesn't seem to fire any RNVoipCall events. I tried to add all the RNVoipCall Android events and none of them are firing.

Also, from the sample code: RNVoipCall.displayIncomingCall(callOptions) .then((data) => {console.log('RNVoipCall data:', data)}) .catch((e) => {console.log('RNVoipCall Error: ' + e)});

The .then part and the .catch part are never reached.
@anjandaffo have you got it to work?

mochi08 avatar Sep 25 '20 04:09 mochi08

@mochi08 No I am still waiting to get this issue fixed.

anjandaffo avatar Sep 25 '20 04:09 anjandaffo

@anjandaffo That's unfortunate. Since the "Answer" button does open the app to the foreground, I wonder if there is any local notification event being fired. If there is, then maybe we can add the codes there to stop the ring tone and close the notification, and do whatever we need to establish the call

mochi08 avatar Sep 25 '20 17:09 mochi08

I am able to get the "onCallAnswer" event to fire when click on the Accept button, but only on my phone with Android 9. My older phone that I use for testing has Android 7 and it doesn't work. Not sure about Android 8 yet, I will have to try it on a simulator later.

mochi08 avatar Sep 26 '20 00:09 mochi08

I use Android 10 but it doesn't work. Please help me!

tkduong98 avatar Jan 22 '21 03:01 tkduong98