ConnectivityManager connManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connManager.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected()) { // The device is connected to the internet } else { // No network connection available }In the above example, we get an instance of the ConnectivityManager using the context, and then use it to check the device's network status. We get information about the currently active network using the `getActiveNetworkInfo()` method, and then check if there is a network connection available. This class is part of the android.net package library, which contains classes and interfaces related to network connectivity on Android devices.