Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ); 
like image 841
Meroelyth Avatar asked Dec 07 '12 16:12

Meroelyth


People also ask

How do I turn off airplane mode on Android permanently?

To turn Airplane mode on or off: Open your phone's Settings app. Tap Network & internet. Turn Airplane mode on or off.

What is the airplane mode trick?

When you activate airplane mode, it stops all signal transmission from your device. You'll see an airplane icon in your phone's status bar when it's turned on.

Can Tasker turn on airplane mode?

Swipe down on the notification bar and touch the "Add" button in the AutoInput notification. Touch "Accept" in the notification and go back to Tasker. There select the "Airplane Mode" text and accept (tap on tick) these settings.

Can Google track you in airplane mode?

So does that mean Google can track your every move even if you don't have a SIM card in your phone and even if it is not connected to a Wi-Fi network? The answer is YES, as many apps use location sharing – which leaves your phone's GPS antenna on, even in airplane mode.


1 Answers

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.

like image 154
DavisNT Avatar answered Sep 28 '22 03:09

DavisNT