アプリケーションで 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();
ありがとう、デビッド