2

I want to enable disable bluetooth from my service class in android i am using the following code

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

But it is not working so how can i enable/disable bluetooth from my service class and which permissions i need

Taimur Ayaz
  • 312
  • 1
  • 6
  • 18

1 Answers1

0

Using Bluetooth Permission :

Have you used this permission in your manifest file :
uses-permission android:name="android.permission.BLUETOOTH"

Anuj
  • 242
  • 2
  • 11