1

When I use "scanBleDevices" from RxAndroidlBle (on Android 6+), I can see my BLE devices. Then I Use another app that scan BLE. Finally, when I go back to my RxAndroidlBle app and start a new "scanBleDevices" it can't find these BLE devices (other app or system can still see them).

Moreover, if I disable the localization (and/or Bluetooth) manually, and re-enable the localization my BLE devices re-appear in my app.

Do you have an idea of the cause?

version: implementation "com.polidea.rxandroidble:rxandroidble:1.4.1"

I also use TedPermission :

new TedPermission(getContext())
                                .setPermissionListener(((ScanActivity)getActivity()))
                                .setPermissions(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION)
                                .setDeniedMessage(R.string.permissions_refused)
                                .check();

then

    @Override
    public void onPermissionGranted()
    {
rxBleClient.scanBleDevices(
                        new ScanSettings.Builder()
                                .setScanMode(ScanSettings.SCAN_MODE_LOW_POWER)
                                .setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES)
                                .build(),
                        ScanFilter.empty())
                        .doOnUnsubscribe(this::removeScanningSubscription)
                        .doOnError(throwable -> Log.e(TAG, throwable.toString()))
                        .subscribe(
                                scanResult -> {
                                    if (scanResult.getBleDevice().getName() != null)
                                    {
                                        EventBus.getDefault().post(new EventBLE(scanResult.getBleDevice()));
                                    }
                                },
                                throwable -> {
// some error process
                                }
                        );
   }

Do you know the cause? And how to solve that?

Thanks you,

0 Answers0