相关疑难解决方法(0)

Android 6.0上的蓝牙低功耗startScan找不到设备

我正在使用Nexus 5开发一个使用蓝牙低功耗的应用程序.它在Lollipop上工作,现在它不能用于Marshmallow.我在清单和活动中的runTime上设置了ACCESS_COARSE_LOCATION和ACCESS_FINE_LOCATION权限.

这是ScanFilters列表:

mScanFilterTest = new ScanFilter.Builder().build();
mScanFilter = new ArrayList<ScanFilter>();
mScanFilter.add(mScanFilterTest);
Run Code Online (Sandbox Code Playgroud)

这些是设置:

mScanSettings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_POWER).setReportDelay(0)
                .setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES).build();
Run Code Online (Sandbox Code Playgroud)

这些是我的回调:

 mBLEScan = new ScanCallback() {
     @Override
     public void onScanResult(int callbackType, ScanResult result) {
         super.onScanResult(callbackType, result);
         Log.i(TAG, "******************************************");
         Log.i(TAG, "The scan result " + result);
         Log.i(TAG, "------------------------------------------");
         }
     };
Run Code Online (Sandbox Code Playgroud)

这是我的电话:

mBluetoothLeScanner.startScan(mScanFilter, mScanSettings, mBLEScan);
Run Code Online (Sandbox Code Playgroud)

它开始扫描但没有找到任何设备.请帮我!!!!

android bluetooth bluetooth-lowenergy android-6.0-marshmallow

46
推荐指数
1
解决办法
4万
查看次数

为什么在Android Marshmallow以后Ble扫描需要位置权限

使用最新版本的Mars称为Marshmallow,启动蓝牙低功耗扫描需要位置组的许可.因此,需要以下权限之一:

ACCESS_COARSE_LOCATION , ACCESS_FINE_LOCATION

任何原因,我们需要打开GPSBLE扫描?

gps android bluetooth-lowenergy

5
推荐指数
1
解决办法
7693
查看次数

需要为 Android 10.0 上的低功耗蓝牙扫描启用定位

将我的 Pixel XL 升级到 Android 10.0 版后,蓝牙低功耗 (BLE) 扫描仅在我打开位置功能时才有效。

直到现在这还不是问题,它可以在运行 Android 9.0、8.0 和 6.0.1 的多个设备上运行。

我的应用程序仅在前台使用 BluetoothLeScanner startScan(List<ScanFilter> filters, ScanSettings settings, ScanCallback callback)

我的应用程序具有 FINE_LOCATION、COARSE_LOCATION 和 BLUETOOTH 权限,我尝试添加 ACCESS_BACKGROUND_LOCATION 权限但没有运气。

Android 10.0 中是否有更严格的应用程序扫描蓝牙设备的要求,我找不到任何关于此的信息,我希望我不必要求用户打开位置以便我的应用程序工作。

android bluetooth bluetooth-lowenergy android-10.0

5
推荐指数
1
解决办法
2755
查看次数