I would like to know if there is a way to know when the user enables or disables the mobile data of the phone.I am NOT looking to see if my phone is currently connected by Mobile Network. I am trying to establish when the user enables / disables Data access over mobile network even if the wifi is connected at that moment.
The idea is to be able to know if the user will not have data once he/she leaves the house.
I tried with a broadcast like this:
<receiver android:name=".MyReceiver">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
and it works. But the problem is that if the user disables or enables Data while connected to the Wifi then there isn't any event, so leaving the house will have the device disconnected.
I need to know this because I want to alert a parental that the kid left the house. I can only do this if the device is connected to internet. So if the wifi is lost I cannot tell the parent. The idea is to tell the parent that Mobile Data is off before leaving the house while there is wifi.