![]() ![]() Iterate through this array and check what type of network is currently active with the device - WIFI or MOBILE using netInfo.getTypeName().equalsIgnoreCase( TYPE). ![]() That returns an ConnectivityManager object, now using this connection manager you can get information of all networks as an NetworkInfo array. I will share the way to monitor the Network Connection Continuously in an Activity or Fragment and we will use Network Callback with a live data observer. Make an activity, which would consists Java file MainActivity.java and an xml file for User interface which would be. Check connections like Wifi and Mobile Subscriber Internet connections like 2g, 3g, 4g, etc.ĬonnectivityManager is the class you can make use of to achieve this, use getSystemService(Context.CONNECTIVITY_SERVICE) Create a project in Android Studio and named it Intents. Android code snippet to check if Internet connectivity is available on Android devices and is active. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |