3

アプリケーションで gsm ネットワークをオフにする必要がありますが、Bluetooth は有効にします。私は機内モードに変更する方法を知っていますAndroidで機内モードを切り替えますが、Bluetooth をオンにしておく方法はありますか? 「オート・エアプレーン」みたいな。

私は助けなしで以下のコードを試しました:

Settings.System.putInt(context.getContentResolver(),
                Settings.System.AIRPLANE_MODE_ON,1);
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", 1);
context.sendBroadcast(intent);

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothAdapter.enable();

ありがとう、デビッド

4

2 に答える 2

0

BLUETOOTH_ADMIN権限で動作していますが、Bluetoothセクションが電話設定から無効になっているため、電話は他のデバイスに表示されます。

于 2012-06-27T11:25:22.020 に答える
0

機内モードはすべての信号をカットするように設計されており、TMHO には Bluetooth が含まれている必要があるため、これは不可能です。

http://en.wikipedia.org/wiki/Airplane_mode

于 2012-06-27T11:22:02.100 に答える