---
title: "How can I monitor for changes to mobile data being enabled on Android?"  
description: "How can I monitor for changes to mobile data being enabled on Android?"  
author: "Anonymous User"  
published: 2015-11-10  
updated: 2023-07-02  
canonical: https://www.mindstick.com/forum/33586/how-can-i-monitor-for-changes-to-mobile-data-being-enabled-on-android  
category: "android"  
tags: ["android"]  
reading_time: 2 minutes  

---

# How can I monitor for changes to mobile data being enabled on Android?

How can I monitor for changes to [mobile data](https://yourviews.mindstick.com/view/85544/beyond-locks-and-passcodes-the-cutting-edge-of-mobile-data-security) being enabled on [Android](https://www.mindstick.com/articles/13046/10-reasons-why-i-prefer-android-vs-iphone-ios)?

## Replies

### Reply by Aryan Kumar

You can monitor for changes to [mobile](https://www.mindstick.com/articles/310668/reasons-why-you-should-choose-custom-mobile-app-development-for-your-business) data being enabled on Android using the **ConnectivityManager** class. The ConnectivityManager class provides access to the device's network connectivity status. You can use the ConnectivityManager class to get a notification when the mobile data status changes.

Here are the steps on how to monitor for changes to mobile data being enabled on Android:

1. Import the `android.net.ConnectivityManager` class.
2. Get an instance of the `ConnectivityManager` class.
3. Register a listener for network connectivity changes.
4. In the listener's `onNetworkAvailable()` method, check if mobile data is enabled.
5. If mobile data is enabled, take the appropriate action.

Here is an example of how to monitor for changes to mobile data being enabled on Android:

Code snippet

```plaintext
import android.net.ConnectivityManager;

public class MyClass {

    private ConnectivityManager connectivityManager;

    public MyClass() {
        connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    }

    public void startMonitoring() {
        connectivityManager.registerNetworkCallback(new NetworkCallback() {
            @Override
            public void onAvailable(Network network) {
                // Mobile data is enabled
            }
        });
    }
}
```

### Reply by Anonymous User

You can use OnNetworkActiveListener to monitor activation of network [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science). The ConnectivityManager class can give you infos on the currently active network connection. It would go like this :\

```
ConnectivityManager cm = getSystemService(Activity.CONNECTIVITY_SERVICE);NetworkInfos networkInfos = cm.getActiveNetworkInfo();if(networkInfos.isConnected()){    //Do something} else {    //Do something else}
```


---

Original Source: https://www.mindstick.com/forum/33586/how-can-i-monitor-for-changes-to-mobile-data-being-enabled-on-android

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
