2

AndroidのサービスクラスからBluetoothの無効化を有効にしたいのですが、次のコードを使用しています

     BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();    
                    if (!mBluetoothAdapter.isEnabled()) {
                        mBluetoothAdapter.enable();
                    }else{ 
                        mBluetoothAdapter.disable(); 
                    }  

しかし、それは機能していないので、サービスクラスからBluetoothを有効/無効にするにはどうすればよいですか?どの権限が必要ですか?

4

1 に答える 1

0

Bluetooth 許可の使用:

マニフェスト ファイルでこの権限を使用しましたか:
uses-permission android:name="android.permission.BLUETOOTH"

于 2013-05-27T06:48:33.890 に答える