make bluetooth device Discoverable - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth On Off

Description

make bluetooth device Discoverable

Demo Code

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

public class Main {

  public static void makeDiscoverable(Activity activity, int duration) {
    Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
    discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, duration);
    activity.startActivity(discoverableIntent);
    Log.i("BluetoothUtils", "Discoverable ");
  }//from ww w . j  a va2  s .  c  o m

}

Related Tutorials