I’m currently working on an application that utilizes the @react-native-community/netinfo package to manage internet connectivity checks. My goal is to ensure that certain functionalities, such as API calls, are triggered based on the device’s current network status. This works seamlessly when the app is running in the foreground or even in the background. However, I’ve encountered an issue where the connectivity checks fail to trigger when the app is completely closed (killed) from the recent tasks.
Here’s a brief overview of my setup:
I’m using the @react-native-community/netinfo package to monitor network changes.
The app successfully triggers API calls based on network availability when the app is open or running in the background.
The issue arises when the app is entirely closed; the connectivity checks do not initiate, preventing any API calls from being made under these conditions.
Could anyone provide insights or solutions on how to achieve this functionality? Any guidance would be greatly appreciated.
Thank you!
I’ve attempted various approaches to address this issue, including:
Ensuring that the listener is correctly set up to handle network changes.
Verifying that the app has the necessary permissions to access network status.
Reviewing the documentation and community discussions for potential workarounds or known issues.
Despite these efforts, I haven’t found a solution that allows the app to check for internet connectivity and potentially trigger API calls when it’s killed from the recent tasks.
Vinayaka Ambore is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.