request Enable Bluetooth - Android Bluetooth

Android examples for Bluetooth:Turn On bluetooth

Description

request Enable Bluetooth

Demo Code

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;

public class Main {
  public static void requestEnable(Context context) {
    context.startActivity(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE));
  }/*w  w w  . j  a  va2  s.c  om*/

  public static void requestEnable(Activity activity, int requestCode) {
    activity.startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), requestCode);
  }
}

Related Tutorials