ScanCall回来没有进入Android Oreo

花门楼前见秋草,岂能贫贱相看老。这篇文章主要讲述ScanCall回来没有进入Android Oreo相关的知识,希望能为你提供帮助。
我无法使我的ble扫描仪工作。没有scanCalll Back正在发生。
以下是我的代码:MainActivity:

public class MainActivity extends AppCompatActivity{@Override protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BluetoothUtil b = new BluetoothUtil(); b.startScan(); }}}

BluetoothUtil:
public class BluetoothUtil extends ScanCallback {BluetoothAdapter badap = BluetoothAdapter.getDefaultAdapter(); ScanSettings.Builder builder = new ScanSettings.Builder(); public BluetoothUtil() {super(); builder.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY); }@Override public void onScanResult(int callbackType, ScanResult result) { Log.v("test","Scanning Occurred"); super.onScanResult(callbackType, result); }public void startScan() { if(badap !=null) { ScanSettings.Builder builder = new ScanSettings.Builder(); builder.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY); if (BluetoothAdapter.getDefaultAdapter().getState() == BluetoothAdapter.STATE_ON) { BluetoothAdapter.getDefaultAdapter().getBluetoothLeScanner().startScan(new ArrayList< ScanFilter> (), builder.build(), this); // BluetoothAdapter.getDefaultAdapter().getBluetoothLeScanner().startScan(this); } } } }

答案【ScanCall回来没有进入Android Oreo】我的错。发布android 6你必须从app gui权限设置应用程序的权限。你必须启用位置和蓝牙。现在就工作了!

    推荐阅读