蓝牙
Android 4.3引入了BluetootheManager 来获取BlueAdapter,并加入了BLE(蓝牙低能耗)蓝牙加强版
private BluetoothAdapter mBluetooth;
public void initBlueTooth(){
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.JELLY_BEAN_MR2){
BluetoothManager bm = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
mBluetooth = bm.getAdapter();
}else{
mBluetooth = BluetoothAdapter.getDefaultAdapter();
}
if(mBluetooth==null){
Toast.makeText( this,"不支持蓝牙", Toast.LENGTH_SHORT).show();
finish();
}
}