Android Detect Internet Connection Status
In this article you will learn how to detect internet connection status manually and automatically. Using broadcast receiver, your app will be automatically notified when there is a change in network connection. This provides easy way do any changes in the app like hiding few button (like WhatsApp hides send, upload icon when there is not internet), navigation user to another screen, or just show a Snackbar message. Creating New Project 1 . Create a new project in Android Studio from File ⇒ New Project . When it prompts you to select the default activity, select Blank Activity and proceed. 2 . Create a class named ConnectivityReceiver.java and extend it from BroadcastReceiver . This is a receiver class which will be notified whenever there is change in network / internet connection. ConnectivityReceiver.java package com.example.bentaherghassen.androiddetectinternetconnection; /** * Created by bentaherghassen on 11/6/2017. */ import android. conte...