赞
踩
我看到stopLeScan()&在Android 5.1.1中不推荐使用startLeScan().我有问题替换我的stopLeScan()& startLeScan()方法.这是我的以下代码:
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
final BluetoothDevice device = mLeDeviceListAdapter.getDevice(position);
if (device == null) return;
final Intent intent = new Intent(this, MainActivity.class);
//intent.putExtra(DeviceControlActivity.EXTRAS_DEVICE_NAME, device.getName());
intent.putExtra(MainActivity.EXTRAS_DEVICE_ADDRESS, device.getAddress());
if (mScanning) {
mBluetoothAdapter.stopScan(mLeScanCallback);
mBluetoothAdapter.getBluetoothLeScanner();
mScanning = false;
}
startActivity(intent);
}
private void scanLeDevice(final boolean enable) {
if (enable) {
// Stops scanning after a pr
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。