Please check the DATA_ROAMING setting
With T-Mobiles data roaming issue out there for Android developers to worry about, it seems like programs accessing the web for data should be checking the DATA_ROAMING System Setting before they acquire their data. The Activity below accesses and displays the result of the Setting.
I’m not a lawyer, but I do feel like I need to state that if your program still incurs roaming charges for the user, please don’t send them to me if you use this code bit. Please thoroughly test your code before you deploy!! Just as a note, I had to install this on my G1 to test it because I couldn’t access the Setting directory from the Android Emulator.
public class DataRoamingSetting extends Activity
{
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView( R.layout.data_roaming_setting );
TextView tv = (TextView)findViewById(R.id.data_roaming);
try
{
int dataRoamingSetting =
Settings.System.getInt( getContentResolver(), Settings.System.DATA_ROAMING );
if ( dataRoamingSetting == 0 )
{
tv.setText( "Data roaming IS NOT enabled" );
}
else
{
tv.setText( "Data roaming IS enabled" );
}
}
catch (SettingNotFoundException e)
{
e.printStackTrace();
}
}
}
