remove Bluetooth Bond - Android Bluetooth

Android examples for Bluetooth:Bluetooth Bond

Description

remove Bluetooth Bond

Demo Code


//package com.java2s;

import java.lang.reflect.Method;

import android.bluetooth.BluetoothDevice;

public class Main {
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public static boolean removeBond(BluetoothDevice btDevice)
            throws Exception {
        Class btClass = Class.forName("android.bluetooth.BluetoothDevice");
        Method removeBondMethod = btClass.getMethod("removeBond");
        Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice);
        return returnValue.booleanValue();
    }//w w w. j  av  a  2s . co m
}

Related Tutorials