Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to turn on Bluetooth in Android app

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 314
    Comment on it

    If you wish to turn on Bluetooth in android when your app run then use the code written below .This code will ask you to turn on your mobile Bluetooth if the Bluetooth is off.

    BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    
    
        if (!mBluetoothAdapter.isEnabled()) 
          {
    
            Intent turnOn = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
                startActivityForResult(turnOn, 0);
                Toast.makeText(getApplicationContext(),"Turned on",Toast.LENGTH_LONG).show();
                }
          else
               {
               Toast.makeText(getApplicationContext(),"Already on", Toast.LENGTH_LONG).show();
              }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: