谁能告诉我如何通过单击 android 中的按钮以编程方式将手机置于飞行模式?
最佳答案
参见博客文章 http://dustinbreese.blogspot.in/2009/04/andoid-controlling-airplane-mode.html ,
仅适用于 API 16
// Toggle airplane mode.
Settings.System.putInt(
context.getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0 : 1);
// Post an intent to reload.
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", !isEnabled);
sendBroadcast(intent);
其中 isEnabled 是飞行模式是否启用。
关于android - 如何在 Android 中以编程方式将手机置于飞行模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19953432/