make Bluetooth device Visible - Android Bluetooth

Android examples for Bluetooth:Bluetooth Device

Description

make Bluetooth device Visible

Demo Code


//package com.java2s;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;

public class Main {
    public static void makeVisible(Context context, int durationSeconds) {
        Intent discoverableIntent = new Intent(
                BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
        discoverableIntent.putExtra(/* ww  w . java2s  .co m*/
                BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION,
                durationSeconds);
        context.startActivity(discoverableIntent);
    }
}

Related Tutorials