create Bond for Bluetooth Device - Android android.bluetooth

Android examples for android.bluetooth:Bluetooth Pair

Description

create Bond for Bluetooth Device

Demo Code

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;
import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class Main{

    static public boolean createBond(Class<?> btClass,
            BluetoothDevice btDevice) throws Exception {
        Method createBondMethod = btClass.getMethod("createBond");
        Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);
        return returnValue.booleanValue();
    }// ww w .  j a v  a  2 s .c o  m

}

Related Tutorials