Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found this in <a href="https://stackoverflow.com/questions/4287506/control-and-display-airplane-mode-in-android">My code toggles airplane mode continuously</a></p> <pre><code>/** Code snippet in AirplaneModeService*/ @Override public void onCreate() { airplaneModeToggler = new AirplaneModeToggler(this); Thread mThread = new Thread(null, airplaneModeToggleTask, "AirplaneModeToggleTask"); mThread.start(); } private Runnable airplaneModeToggleTask = new Runnable() { @Override public void run() { airplaneModeToggler.toggle(null); AirplaneModeService.this.stopSelf(); } }; </code></pre> <p>I think you need to do an asynchronous task to d that as you can see up here or in the post I linked you.</p> <p>Edit: I also found here <a href="https://stackoverflow.com/questions/4319212/how-can-one-detect-airplane-mode-on-android">How can one detect airplane mode on Android?</a> in the answer the way to know if it is activated or not (to do something or not ;) )</p> <pre><code>/** * Gets the state of Airplane Mode. * * @param context * @return true if enabled. */ private static boolean isAirplaneModeOn(Context context) { return Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0; } </code></pre> <p>And finally I found this <a href="http://dustinbreese.blogspot.com.es/2009/04/andoid-controlling-airplane-mode.html" rel="nofollow noreferrer">http://dustinbreese.blogspot.com.es/2009/04/andoid-controlling-airplane-mode.html</a> where I think there is all you need!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload