1
votes

In my application I need to start some BLE scans, get the results and then show them in a list or in a grid.

When i start the scan my device start to look for advertisements basing on which ScanFilters I wrote.

Every time a Pheriperal is found I the application trigger the scan callback method and i can add the new device into the list.

If i got an error the app trigger the callback method and i can tell the user about the broblem.

Example

Imagine the Scan going on for 30s. At the moment it starts i get 3 Ble Pheriperal. At second 15 one of them stop to advertise and turn bluetooth off. At the end of the scan my list will have 3 Ble devices but i will not be able to connect to one of them.

How do I know which of them is the one which turned off? Where do i get his status?

Thanks for the help.

1

1 Answers

1
votes

You can try this, technically it is possible as per the documentation. in onScanResult callback, check for the callbackType parameter. If it is CALLBACK_TYPE_MATCH_LOST then get the device from the results and remove it from your cache.