在Android设备上以编程方式确定蓝牙堆栈版本

时间:2011-07-21 11:40:17

标签: android bluetooth

如何以编程方式在Android设备上找到Bluetooth堆栈版本?

例如,找到Android版本的方法是 android.os.Build.VERSION.RELEASE 。那么,有没有类似的方法来找出蓝牙堆栈版本?

1 个答案:

答案 0 :(得分:1)

int version = Integer.parseInt(Build.VERSION.SDK);
String bluezStack = "";
switch (version) {
    case Build.VERSION_CODES.BASE:
    case Build.VERSION_CODES.BASE_1_1:
    case Build.VERSION_CODES.CUPCAKE:
    case Build.VERSION_CODES.DONUT:
        bluezStack = "Bluez 3.36";
        break;
    case Build.VERSION_CODES.ECLAIR:
    case Build.VERSION_CODES.ECLAIR_0_1:
    case Build.VERSION_CODES.ECLAIR_MR1:
    case Build.VERSION_CODES.FROYO:
        bluezStack = "Bluez 4.47";
        break;
    case Build.VERSION_CODES.GINGERBREAD:
    case Build.VERSION_CODES.GINGERBREAD_MR1:
    case Build.VERSION_CODES.HONEYCOMB:
    case Build.VERSION_CODES.HONEYCOMB_MR1:
    case Build.VERSION_CODES.HONEYCOMB_MR2:
        bluezStack = "Bluez 4.69";
        break;
    default:
        break;
}