• 9
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I am currently trying to scan BLE devices, I am using a Galaxy S9+ with android 9.0. It seems unfiltered scans don't work with galaxy s9+ so I added filters like this

String serviceUuidString = "51525354-5556-5758-5950-abbccddeeff0"; //uuid i wanna scan
String serviceUuidMaskString = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF";
ParcelUuid parcelUuid = ParcelUuid.fromString(serviceUuidString); 
ParcelUuid parcelUuidMask = ParcelUuid.fromString(serviceUuidMaskString);

ScanFilter filter1 = new ScanFilter.Builder().setServiceUuid(parcelUuid, parcelUuidMask).build();
filters.add(filter1);

This did not work but as soon as I added this

ScanFilter filter = new ScanFilter.Builder().setDeviceAddress("D8:09:1A:58:41:39").build();
filters.add(filter);

It started detecting beacons after phone is locked. I dont think aadding each and every mac would be a good method though. Is there something wrong being done while adding filters for uuid?

this is how i build settings

settings = scanSettingsBuilder.build();

Double check to be absolutely certain you have your Service UUID correct in the filter. It may be helpful to print out a LogCat line from the operating system when the service advertisement packet is detected (without filters) and post that here.

For what it's worth, very similar code exists in the Android Beacon Library to scan in the background for Eddystone Service UUIDs using the following code, and I have verified it works on the Galaxy S9 (albeit not with Android 9.0 yet). The main difference in the code below from what you have is that it formats a 16-bit UUID as 128 bit UUID. But I think that is unlikely to make a difference.

            ScanFilter.Builder builder = new ScanFilter.Builder();
            String serviceUuidString = String.format("0000%04X-0000-1000-8000-00805f9b34fb", sfd.serviceUuid);
            String serviceUuidMaskString = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF";
            ParcelUuid parcelUuid = ParcelUuid.fromString(serviceUuidString);
            ParcelUuid parcelUuidMask = ParcelUuid.fromString(serviceUuidMaskString);
            builder.setServiceUuid(parcelUuid, parcelUuidMask);
            ScanFilter scanFilter = builder.build();
            scanFilters.add(scanFilter);
  • 1
Reply Report