如何设置AIRPLANE_MODE_ON至"真"或ON? [英] How to set the AIRPLANE_MODE_ON to "True" or ON?
本文介绍了如何设置AIRPLANE_MODE_ON至"真"或ON?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我打算放弃打个电话,我发现这是解决办法的那一个。 如何激活通过code中的飞行模式?
I am planning to drop a call and I find this as one of workaround for that. How do I activate the airplane mode via code?
这样,我将基于一些事件挂断电话。
This way I will drop the call based on some event.
推荐答案
请参阅博客文章的的安卓控制飞行模式 的
See the blog article Android: Controlling Airplane Mode ,
仅工作高达 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
为飞行模式是否已启用。
where isEnabled
is whether airplane mode is enabled or not.
这篇关于如何设置AIRPLANE_MODE_ON至"真"或ON?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文