Android Development AIRPLANE_MODE_ON Query
On a Xoom Android Tablet, this code works
protected static boolean isAirplaneModeOn(Context context)
{
return
Settings.System.getInt(context.getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0) != 0;
}
But on an Acer Icona A500, it does not. However, this
protected static boolean isAirplaneModeOn(Context context)
{
return
Settings.System.getInt(context.getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0) == 1;
}
works on both devices. If you've read the Android SDK documentation, it is less than clear about the distinction. I've found example uses for the first code online, so I guess many programs may not properly recognize Airplane_Mode. As a C/C++ dev, we expect comparisons to be against 0 or non-zero, not some magic number, 1.