When app goes in background state client disconnected from openTok session - React Native - react-native

connectionDestroyed event being triggered when the app goes into the background and client is disconnecting with session. However, session is still alive. So here, my question is that how can i reconnect client with existing session in openTok react native.

Related

displaying notifications when the app is killed - React Native

I have a problem with diplaying notification while running socket connection in the background service i'm using react-native-backgound-action.
Problems i have right now:
when notification is sent from the backend nothing is been shown i'm using "stompJS" as socket connection and notifee as notification package.
react native background actions use forground service that shows a permanent notification in android.
i have tried to run notification in background

Socket.io keeps disconnect if I dont touch the app for a long time

I am creating a voice call mobile app using react native as my mobile app and node.js as my backend and i noticed my socket keeps disconnecting when I dont touch the app for a long time. Since I am creating a voice call, the users doesn't really need to touch the app. Any ideas how i can fix this?

react-native-firebase - Open app from Headless JS Service / Open app from received notification in background mode

I read
How to handle notification when app in background in Firebase
Open app on firebase notification received (FCM)
But these aren't the solution for react-native-firebase.
I'm using react-native-firebase to handle notifications. In foreground, everything works well. I stuck with background state.
I'm working on a chat project and making 1-to-1 call feature. I push data-notification to clients when they have a call. In iOS, I used CallKit when client received notification, and it worked fine. But in Android I have a problem:
I can show ConnectionService UI for a call, but can't connect to my web socket server because it runs on Headless JS service. So I tried to auto open the app. I want to show a call screen as Skype, and accept/deny the call. (Skype can launch the app when I have a call)
Summary, successful steps:
Receive call notification in foreground state and show calling screen.
Receive call notification in background/closed state and show calling screen on iOS.
Receive call notification in background/closed state on Android.
Stuck here:
Show calling screen in background/closed on Android ???
TL;DR - How to launch/run/open Android app from Headless JS Service?
I dig into react-native-firebase, it catches the notification on onMessageReceived and send notification message to Headless JS Service.
// If the app is in the background we send it to the Headless JS Service
Intent headlessIntent = new Intent(
this.getApplicationContext(),
RNFirebaseBackgroundMessagingService.class
);
headlessIntent.putExtra("message", message);
this
.getApplicationContext()
.startService(headlessIntent);
HeadlessJsTaskService.acquireWakeLockNow(this.getApplicationContext());
Any help would be appreciated
This library is helpful to open app from background state.
React Native Launch Application
If your app is quit from background state
you've to register registerHeadlessTask in index.js like this
AppRegistry.registerHeadlessTask(
'ReactNativeFirebaseMessagingHeadlessTask',
() => notificationActionHandler,
);
and in notificationActionHandler function call libraries function to open app
If your app is in background you can subscribe this
messaging().setBackgroundMessageHandler(remoteMessage => {
console.log('setBackgroundMessageHandler', remoteMessage.data);
})

react native app continuously switching network between cell and wifi

I have a chat application in react native.
I am using NetInfo for connection check but i am encountering this weird issue that the connection is switching between "wifi" and "cell" automatically which results in app hang

WL push notification callback not being invoked in iOS when app is in background

We have push notifications working successfully. Backend event source is a Worklight adapter written in JS using the 'WL.Server.createDefaultNotification' and 'WL.Server.notifyAllDevices' API calls to send unicast notifications. In the front-end, the app is registered for push notification call back using 'WL.Client.Push.registerEventSourceCallback' JS API.
These particular scenarios are not working:
App is open in the background after login. Notification message is received, but user does not tap notification banner message - and instead just opens app by touching app icon. Notification callback method is not called - and subsequently payload from the backend is not available for the method.
App is open in the background after login. Notification message is received which only has iOS badge change and payload but no notification message for the banner or lock screen. In which case user has nothing to tap on. When user opens the app again - notification callback is not called.
Knowledgecenter documentation seems to indicate that the callback method should be getting invoked even if the app is running in the background. This is with Worklight 6.2.0.1.
Push is indeed supposed to work as you've describe. This is a bug.
This is no manual workaround for this.
If you are an IBM customer or Business Partner you will need to open a PMR (support ticket).