airplane

How to turn on/off airplane mode, even on new Android versions (and even with root)?

怎甘沉沦 提交于 2019-11-27 04:35:30
问题 Starting with Android 4.2 , turning on/off airplane mode isn't supported using normal APIs. It should probably work when WRITE_SECURE_SETTINGS permission is granted, but that's only for system apps (as I've read). What should be done in order to do it on devices with root? Should a system app also require root in order to toggle airplane mode? 回答1: To toggle Airplane / Flight mode on and off on an Android rooted device (phone, tablet, note), you can do the following: private final String

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

孤街醉人 提交于 2019-11-26 20:09:16
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

Toggling AirPlane mode in iOS Programmatically

我的梦境 提交于 2019-11-26 16:28:18
问题 I want to on/off airplane mode in iOS programmatically. After googling, i got some of the following links, and followed them, Reachability airplane mode (3G) vs. Wifi Using Private Framework: Importing RadioPreferences.h Detect if iPhone is in Airplane mode? All of the above links, tell me to use AppSupport.framework and using RadiosPreferences.h. This is giving me the status about whether airPlane mode is on or off, But it doesn't make me to change the airplane mode. Then i saw, this link,

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

眉间皱痕 提交于 2019-11-26 07:30:57
问题 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 ); 回答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

How can one detect airplane mode on Android?

Deadly 提交于 2019-11-26 03:32:42
问题 I have code in my application that detects if Wi-Fi is actively connected. That code triggers a RuntimeException if airplane mode is enabled. I would like to display a separate error message when in this mode anyway. How can I reliably detect if an Android device is in airplane mode? 回答1: /** * Gets the state of Airplane Mode. * * @param context * @return true if enabled. */ private static boolean isAirplaneModeOn(Context context) { return Settings.System.getInt(context.getContentResolver(),

Toggle airplane mode in Android

柔情痞子 提交于 2019-11-26 01:47:06
问题 Did I make a mistake? It\'s not working. public void airplane() { boolean isEnabled = Settings.System.getInt(this.getApplicationContext().getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1; Settings.System.putInt(context.getContentResolver(),Settings.System.AIRPLANE_MODE_ON,isEnabled ? 0 : 1); //Settings.System.putInt(this.getApplicationContext().getContentResolver(),Settings.System.AIRPLANE_MODE_ON,isEnabled ? 0 : 1); Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE