Android
Bluetooth가 off 되었어도 스캔할 수 있는 방법
권파인
2016. 6. 14. 15:51
mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUET
OOTH_SERVICE );
mBluetoothAdapter = mBluetoothManager.getAdapter(); try {
// 리플랙션
Method method = mBluetoothAdapter.getClass().getMethod("enableBLE"); Log.d(TAG, ">> " +result);
boolean result = (Boolean) method.invoke(mBluetoothAdapter);
} catch (Exception e){
Log.e(TAG, e.getMessage());
}
// 스캔
mBluetoothAdapter.startLeScan(null , mLeScanCallback);