首页 > 移动平台 > 详细

Android Bluetooth 配对

时间:2014-03-20 18:08:59      阅读:599      评论:0      收藏:0      [点我收藏+]

android 配对与取消配对的方法:

bubuko.com,布布扣
private void pairDevice(BluetoothDevice device) {
try {
    if (D)
    Log.d(TAG, "Start Pairing...");

    waitingForBonding = true;

    Method m = device.getClass()
        .getMethod("createBond", (Class[]) null);
    m.invoke(device, (Object[]) null);

    if (D)
    Log.d(TAG, "Pairing finished.");
} catch (Exception e) {
    Log.e(TAG, e.getMessage());
}
}

private void unpairDevice(BluetoothDevice device) {
try {
    Method m = device.getClass()
        .getMethod("removeBond", (Class[]) null);
    m.invoke(device, (Object[]) null);
} catch (Exception e) {
    Log.e(TAG, e.getMessage());
}
}
bubuko.com,布布扣

Android Bluetooth 配对,布布扣,bubuko.com

Android Bluetooth 配对

原文:http://www.cnblogs.com/ikaka/p/3612999.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!