How to programmatically enable and disable Flight mode on Android 4.2?

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 … Read more

Toggle airplane mode in Android

This answer contains code necessary to do this. Also make sure you have the WRITE_SETTINGS permission. Adapted from Controlling Airplane Mode: // read the airplane mode setting boolean isEnabled = Settings.System.getInt( getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1; // toggle airplane mode Settings.System.putInt( getContentResolver(), Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0 : 1); // Post an intent to reload Intent … Read more