Problems on using BLE

Hello.
I am trying to create a sort of social distancing app for my project. Basically, the app tracks the distance between the users by using the RSSI value of the Bluetooth, and the time of the record. Using some formulas implemented in php I managed to determine whether a person is a contact or not. It is not perfect due to the fact that the information used is not accurate, but it is fairly close.
The app goes through all the php files and implements them (sorry is the terms used are not entirely accurate). It works fine. The only problem is when it comes to scanning for Bluetooth devices and connecting to them. It works randomly at the begining and after a while (let’s say about 10-15 minutes) it stops responding correctly, even if the rest of the app is running accordingly.
Building the app I used the BluetoothLE extension version 20200828 (the newer one from December would not work on my project) and the com.kio4.servicio.aix Extension for running in the background which works amazing. For testing I use Android12, 10, and 9 on Samsung, Huawey, Motorola, and OnePlus.


Any idea regarding what I should do is more than welcomed. And also, if there are any suggestions regarding some improvements I could bring I would be more than happy to implement them.