How to maintain a socket connection in a React Native app when the app is in background (IOS and Android)

93 Views Asked by At

I am building a live location tracking app in react native. I am using expo-location and expo-task-manager for getting gps location while the app is foreground and background. On every location update I am sending the coordinates to another app using the socket events.

But now the issue is that many times the socket gets disconnected when the app goes into background and the app is no longer able to send location to other app.

How can I keep this socket connection alive when the app goes into background on both IOS and Android. These location updates need to be very quick so I need a very reliable solution for it.

And how the apps like Zomato able to achieve this type of functionality seamlessly.

0

There are 0 best solutions below