I created a BroadcastReceiver that listens for a CONNECTIVITY_CHANGE event. For now, I simply print out the action of the Intent that calls the BroadcastReceiver and its extras. I'm using a test phone in our office here in Manila and the SIM card is from Denmark. When onReceive() is invoked, this is what gets printed out in LogCat:
action: android.net.conn.CONNECTIVITY_CHANGE
key: extraInfo, value: data.tre.dk
key: htcCurrentActiveNetwork, value: null
key: networkInfo, value: null
key: reason, value: roamingOn
key: noConnectivity, value: null
key: inetCondition, value: null
I need to know what the value of reason is when the roaming goes off--could be roamingOff by guessing, but I can't know for sure, unless I go to Denmark. This is because I need to perform a task when the roaming service gets turned off, and I noticed from LogCat that the CONNECTIVITY_CHANGE event is fired for reasons other than toggling the roaming modes. Or is there a better way of detecting when roaming is turned off?
Code for the broadcast receiver:
public void onReceive(Context context, Intent intent) {
    Log.d(This.LOGTAG, "action: " + intent.getAction());
    Bundle extras = intent.getExtras();
    for (String key : extras.keySet()) {
        Log.d(This.LOGTAG, "key: " + key + ", value: " + extras.getString(key));
    }
}
Manifest entry:
<receiver android:name=".listener.RoamingListener">
    <intent-filter>
        <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
    </intent-filter>
</receiver>
 
    