request Bluetooth Pairing - Android Bluetooth

Android examples for Bluetooth:Bluetooth Bond

Description

request Bluetooth Pairing

Demo Code


//package com.java2s;

import android.app.Activity;

import android.bluetooth.BluetoothDevice;

import android.content.Intent;

public class Main {
    public static void requestPairing(BluetoothDevice device,
            Activity activity) {//from ww w .j  a  v  a2  s .  c  o  m
        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);
    }
}

Related Tutorials