How to Monitor/Observe Network Availability for Android Projects

<p>Network/Cellular data is widely used in Android Projects. Most of the app currently exist in the play store have API call some way or another. As in the nature of API (Application Programming Interface), you are interacting with another application that your project does not have any authority in the codebase. Sometimes, these APIs fail. And, when they fail, it is very important to show proper error message to the customers about what went wrong. Otherwise, the users will think that your app is not working properly.</p> <p>One common problem that API might be failing due to the network availability. In case there is no cellular connection available in the user&rsquo;s device, the API might fail. Since we as developers know that it does not make sense to use resources to launch a network call when there is no cellular/wifi connection available, a message can be prompted to the users regarding to the network availability. Thus, the customers can try to find a network connection and then start using your application.</p> <p>In this article, we will try to cover how we can monitor, observe, or collect the network availability so that the user will not need to re-launch your app when they get a good connection. We will use&nbsp;<code>ConnectivityManager</code>&nbsp;service, which is already provided in Android SDK.</p> <p><a href="https://pinarturgut09.medium.com/how-to-monitor-observe-network-availability-for-android-projects-3e4aeeb364ec">Read More</a></p>