启用飞行模式与出禁用WiFi和蓝牙的机器人 [英] Enable Flight mode with out disabling the wifi and bluetooth in android

查看:210
本文介绍了启用飞行模式与出禁用WiFi和蓝牙的机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要启用飞行模式,但如果我能飞行模式我不能能够使用蓝牙,WiFi。我的目的是限制只接收电话和短信相关的东西。

I want to enable Flight mode but if i enable flight mode i cant able to use bluetooth , wifi. my purpose is to restrict only the receiving call and sms related things.

我尝试以下,但它不工作;

I tried the following, but its not working;

Settings.System.putString(getContentResolver(),
           Settings.System.AIRPLANE_MODE_RADIOS, "cell,bluetooth");

任何一个可以帮助我在此

can any one help me in this

推荐答案

您可以改变什么无线电将被关闭时,空调平面模式被激活。如果你这样做激活空气平面模式之前,有可能只关闭无线小区。

You can change what radios that will be turned off when air-plane mode is activated. If you do this before activating air-plane mode, it is possible to only turn off the radio cell.

注:更改AIRPLANE_MODE_RADIOS影响系统按钮,用于切换空气平面行为

下面是一些示例code,在Android 2.2的测试。

Here's some sample code, tested on Android 2.2.

// Toggle airplane mode.
Settings.System.putInt(context.getContentResolver(),
    Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0 : 1);

// Change so that only radio cell is turned off
// NOTE: This affects the behavior of the system button for
// toggling air-plane mode. You might want to reset it, in order to
// maintain the system behavior.
Settings.System.putString(context.getContentResolver, 
    Settings.System.AIRPLANE_MODE_RADIOS, "cell"); 

// Post an intent to reload.
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", !isEnabled);
sendBroadcast(intent);

这篇关于启用飞行模式与出禁用WiFi和蓝牙的机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆