Android Detect Internet Connection Status [UPDATED]
In android, by using ConnectivityManager class we can easily determine whether the network or internet connected or not and also we can determine the type of internet connection currently available i.e. whether it’s mobile data or Wi-Fi. To get the internet connection status, our app must acquire the INERTNET and ACCESS_NETWORK_STATE permissions. For that, we need to add the following permissions in android manifest file like as shown below. < manifest > .... < uses-permission android:name="android.permission.INTERNET" /> < uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> .... </ manifest > Check Internet Connection Status In android, we can determine the internet connection status easily by using getActiveNetworkInfo() method of ConnectivityManager object. Following is the code snippet of using ConnectivityManager class to know whether internet connection ...