enable Bluetooth Settings - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth Enable

Description

enable Bluetooth Settings

Demo Code

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.text.TextUtils;
import java.util.Locale;

public class Main{

    public static void enableBluetoothSettings(Activity activity) {
        Intent discoverableIntent = new Intent(
                BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
        discoverableIntent.putExtra(/*  w w w.  j ava2s . c o  m*/
                BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0);
        activity.startActivityForResult(discoverableIntent, 0);
    }

}

Related Tutorials