After a while the connection is disconnecting while the application is in the background. I’m testing on Android how can i prevent disconnect problem
We have observed this problem with recent Android versions. One way around it is to use a Connec tion Service (see https://github.com/wazo-pbx/react-native-callkeep) or an Android ongoing notification.
Could you please provide a example with https://github.com/oney/RCTWebRTCDemo because i can’t understand exactly how to use react-native-callkeep or an Android ongoing notification.
Sorry I can’t provide such example as I don’t have one.
I tried to use react-native-backgroundjob for keep app alive but it’s work only short time period like 5-10 minute. I’m really stuck this point. Can I open an issue in Github for this?
Opending an issue won’t help. I already told you 2 ways to solve it: callkeep ir an ongoing notification. Have you tried any of them?
https://github.com/evollu/react-native-fcm/pull/496 i use this and it’s show notification, but still sound disappears after 20 seconds. I installed the react-native-callkeep library and tried to implement the codes according to the example here https://github.com/wazo-pbx/wazo-react-native-demo but did not work. I’m having trouble understanding this structure because it’s not exactly the same with this sample https://github.com/oney/RCTWebRTCDemo
i think android kills the services we call with ThreadUtils.java .
i wanted to open an issue because may be other people already solve this problem and they can help
showLocalNotification(notif) {
FCM.presentLocalNotification({
id: new Date().valueOf().toString(), // (optional for instant notification)
title:notif.title, // as FCM payload
body: notif.body, // as FCM payload (required)
show_in_foreground: true ,
ongoing: true
});
}
pc.onaddstream = function (event) {
/…/
RNCallKeep.startCall(this.getCurrentCallId(), null); //Rn callkeep
showLocalNotification(notif)
/…/
}
function leave(socketId)
{
/…/
RNCallKeep.endCall(this.getCurrentCallId());
this.currentCallId = null;
/…/
}
i don’t use callkeep myself, so feel free to open an issue and hopefully someone can help.
I tested jitsi meet and it’s working in background perfectly. Is it Developed with React Native? if it is how does it work in the background. Is there any code can take as an example?
Thank you for interest.
Yes, Jitsi Meet is developed with RN and it uses this very plugin. It does nothing special to run in the background. We do use this plugin so JS timers work in the background: https://github.com/ocetnik/react-native-background-timer
I tried using background Timer but still i am losing the connection. Are you guys using this plugin in different way
We are using the plugin to globally patch setTimeout / setInterval, because otherwise JS timers don’t run when the app is in the background.
I’ve used it globally and the app has worked in background without a problem for 40+ minutes while the phone was in charge and i close the connection myself. I tested it again when the phone was not in charge and 12 minutes worked in the background then the sound disappeared. I re-tested the jitsi meet app and it worked for 14 minutes when the phone wasn’t charging. You also have the same problem. I think we have a problem about battery usage. I tested it on my lg g4 phone.
Thank you for your help. You helped me much. I think we are going right direction.
On Android, they changed something in Oreo (I think). By using callkeep that should be solved. CallKeep uses Android’s ConnectionServices, which Jitsi uses manually now, so that should take care of it.
My android version is 5.0 lollipop Jitsi Meet I have tested with the current version of this application. App worked without a problem in the background while it was charging but the phone was not in charge it’s worked only 14 minutes. If you are using CallKeep in Google play version of this app it’s not working. I facing this problem with my LG G4 5.0 device. I will test it another devices too.
No, the play store version hasn’t been updated yet. When you did your tests, with Jitsi, were you alone in the room?
No i open this url on my browser https://meet.jit.si/ and create a room. After creating the room i’m joining same room on my phone.
When will you release the update? Once you’ve released it, if there is no problem I’m going to try to use callkeep in my application. https://github.com/ocetnik/react-native-background-timer Will you continue to use this plugin?or you will only use a callkeep
The update should be reselased soon. Yes, wie will continue to use the plugin because otherwise JS timers don’t run in the background, which we need to keepalive.
Are you using this repo https://github.com/jitsi/jitsi-meet if it is it’t too complicated i can’t understand after the update could you share basic example of callkeep usage ?