Is there a way to disable or enable Flight Mode on Android 4.2?
I use this code that works only for previous Android versions:
android.provider.Settings.System.putInt(
c.getContentResolver(),
android.provider.Settings.System.AIRPLANE_MODE_ON, enable ? 0 : 1
);
There exist a simple workaround on rooted devices.
To enable Airplane Mode the following root shell commands can be used:
settings put global airplane_mode_on 1
am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
To disable Airplane Mode these root shell commands can be used:
settings put global airplane_mode_on 0
am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
Info taken from here
Disclaimer: This info is provided "as-is" without any form of warranty.