enable Bluetooth Settings - Android Bluetooth

Android examples for Bluetooth:Turn On bluetooth

Description

enable Bluetooth Settings

Demo Code


//package com.java2s;

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

public class Main {
    public static void enableBluetoothSettings(Activity activity) {
        Intent discoverableIntent = new Intent(
                BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
        discoverableIntent.putExtra(//from  w w w . j  a  v a 2  s .  c o  m
                BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 0);
        activity.startActivityForResult(discoverableIntent, 0);
    }
}

Related Tutorials