request Pairing for Bluetooth Device - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth Pair

Description

request Pairing for Bluetooth Device

Demo Code

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

public class Main {

  public static void requestPairing(BluetoothDevice device, Activity activity) {
    Intent intent = new Intent("android.bluetooth.device.action.PAIRING_REQUEST");
    intent.putExtra("android.bluetooth.device.extra.DEVICE", device);
    intent.putExtra("android.bluetooth.device.extra.PAIRING_VARIANT", 0);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    activity.startActivity(intent);/*w  w  w .  j  a  v a2s. c  om*/
  }

}

Related Tutorials