vitorpamplona / react-native-ble-advertiser

Bluetooth Advertiser/Scanner for React Native.
60 stars 38 forks source link

BUG scanByService failed #50

Open Dorbmon opened 1 year ago

Dorbmon commented 1 year ago

in BLEAdvertiserModule.java, We have code :

if (manufacturerPayload == null)
            filters = null;
if (manufacturerPayload != null)
            filters.add(new ScanFilter.Builder().setManufacturerData(companyId, toByteArray(manufacturerPayload)).build());
if (uid != null) 
            filters.add(new ScanFilter.Builder().setServiceUuid(ParcelUuid.fromString(uid)).build());

And in

public void scanByService(String uid, ReadableMap options, Promise promise) {
        scan(uid, null, options, promise);
}

The manufacturerPayload is passed as null, this will cause filters to be null and filters.add(new ScanFilter.Builder().setServiceUuid(ParcelUuid.fromString(uid)).build()); will still run causing a runtime error of invalid address visit.